原文链接: https://leetcode-cn.com/problems/shopping-offers 英文原文In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale p…
标签详情
回溯 分类
原文链接: https://leetcode-cn.com/problems/24-game 英文原文You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. You should arrange the numbers on these cards in a mathematical expression using t…
原文链接: https://leetcode-cn.com/problems/stickers-to-spell-word 英文原文We are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cutting individual letters from your…
原文链接: https://leetcode-cn.com/problems/partition-to-k-equal-sum-subsets 英文原文Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal. Example 1: Input: nums = […
原文链接: https://leetcode-cn.com/problems/letter-case-permutation 英文原文Given a string s, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. You can retu…
原文链接: https://leetcode-cn.com/problems/all-paths-from-source-to-target 英文原文Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any order. The graph is given as …
原文链接: https://leetcode-cn.com/problems/ambiguous-coordinates 英文原文We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)". Then, we removed all commas, decimal points, and spaces and ended up with the string s. For example, "(1, 3)" becomes…
原文链接: https://leetcode-cn.com/problems/split-array-into-fibonacci-sequence 英文原文You are given a string of digits num, such as "123456579". We can split it into a Fibonacci-like sequence [123, 456, 579]. Formally, a Fibonacci-like sequence is a list f …
原文链接: https://leetcode-cn.com/problems/numbers-with-same-consecutive-differences 英文原文Return all non-negative integers of length n such that the absolute difference between every two consecutive digits is k. Note that every number in the answer must n…
原文链接: https://leetcode-cn.com/problems/unique-paths-iii 英文原文You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exactly one starting square. 2 representing the ending square. There is exac…
原文链接: https://leetcode-cn.com/problems/number-of-squareful-arrays 英文原文An array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, return the number of permutations of nums that are squareful. …
原文链接: https://leetcode-cn.com/problems/brace-expansion-ii 中文题目如果你熟悉 Shell 编程,那么一定了解过花括号展开,它可以用来生成任意字符串。 花括号展开的表达式可以看作一个由 花括号、逗号 和 小写英文字母 组成的字符串,定义下面几条语法规则: 如果只给出单一的元素 x,那么表达式表示的字符串就只有 "x"。R(x) = {x} <ul> <li>例如,表达式 <code>"a"</code> 表示字符串 <c…
原文链接: https://leetcode-cn.com/problems/iterator-for-combination 英文原文Design the CombinationIterator class: CombinationIterator(string characters, int combinationLength) Initializes the object with a string characters of sorted distinct lowercase Engli…
原文链接: https://leetcode-cn.com/problems/path-with-maximum-gold 英文原文In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the maximum amount of gold you can colle…
原文链接: https://leetcode-cn.com/problems/circular-permutation-in-binary-representation 英文原文Given 2 integers n and start. Your task is return any permutation p of (0,1,2.....,2^n -1) such that : p[0] = start p[i] and p[i+1] differ by only one bit in the…
原文链接: https://leetcode-cn.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters 英文原文You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the …
原文链接: https://leetcode-cn.com/problems/tiling-a-rectangle-with-the-fewest-squares 英文原文Given a rectangle of size n x m, return the minimum number of integer-sided squares that tile the rectangle. Example 1: Input: n = 2, m = 3 Output: 3 Explanation: 3…
原文链接: https://leetcode-cn.com/problems/maximum-score-words-formed-by-letters 英文原文Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words formed by using the g…
原文链接: https://leetcode-cn.com/problems/verbal-arithmetic-puzzle 英文原文Given an equation, represented by words on left side and the result on right side. You need to check if the equation is solvable under the following rules: Each character is decoded …
原文链接: https://leetcode-cn.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n 英文原文A happy string is a string that: consists only of letters of the set ['a', 'b', 'c']. s[i] != s[i + 1] for all values of i from 1 to s.length …
原文链接: https://leetcode-cn.com/problems/probability-of-a-two-boxes-having-the-same-number-of-distinct-balls 英文原文Given 2n balls of k distinct colors. You will be given an integer array balls of size k where balls[i] is the number of balls of color i. A…
原文链接: https://leetcode-cn.com/problems/split-a-string-into-the-max-number-of-unique-substrings 英文原文Given a string s, return the maximum number of unique substrings that the given string can be split into. You can split string s into any list of non-e…
原文链接: https://leetcode-cn.com/problems/distribute-repeating-integers 英文原文You are given an array of n integers, nums, where there are at most 50 unique values in the array. You are also given an array of m customer order quantities, quantity, where qu…
原文链接: https://leetcode-cn.com/problems/splitting-a-string-into-descending-consecutive-values 英文原文You are given a string s that consists of only digits. Check if we can split s into two or more non-empty substrings such that the numerical values of th…
原文链接: https://leetcode-cn.com/problems/sum-of-all-subset-xor-totals 英文原文The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1. Giv…
原文链接: https://leetcode-cn.com/problems/maximum-compatibility-score-sum 英文原文There is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes). The survey was given to m students numbered from 0 to m - 1 and m ment…
原文链接: https://leetcode-cn.com/problems/find-unique-binary-string 英文原文Given an array of strings nums containing n unique binary strings each of length n, return a binary string of length n that does not appear in nums. If there are multiple answers, y…
原文链接: https://leetcode-cn.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences 英文原文Given a string s, find two disjoint palindromic subsequences of s such that the product of their lengths is maximized. The two subsequences are d…
原文链接: https://leetcode-cn.com/problems/longest-subsequence-repeated-k-times 英文原文You are given a string s of length n, and an integer k. You are tasked to find the longest subsequence repeated k times in string s. A subsequence is a string that can be…
原文链接: https://leetcode-cn.com/problems/number-of-valid-move-combinations-on-chessboard 英文原文There is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishops). You are given a string array pieces of length n, where pieces[i] describes the ty…