原文链接: https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number 英文原文Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping o…
标签详情
回溯 分类
原文链接: https://leetcode-cn.com/problems/generate-parentheses 英文原文Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa…
原文链接: https://leetcode-cn.com/problems/sudoku-solver 英文原文Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row. Each …
原文链接: https://leetcode-cn.com/problems/combination-sum 英文原文Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the c…
原文链接: https://leetcode-cn.com/problems/combination-sum-ii 英文原文Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in cand…
原文链接: https://leetcode-cn.com/problems/permutations 英文原文Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],…
原文链接: https://leetcode-cn.com/problems/permutations-ii 英文原文Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,1,2] Output: [[1,1,2], [1,2,1], [2,1,1]] …
原文链接: https://leetcode-cn.com/problems/n-queens 英文原文The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. You…
原文链接: https://leetcode-cn.com/problems/n-queens-ii 英文原文The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queen…
原文链接: https://leetcode-cn.com/problems/combinations 英文原文Given two integers n and k, return all possible combinations of k numbers out of the range [1, n]. You may return the answer in any order. Example 1: Input: n = 4, k = 2 Output: [ [2,4], [3,4], …
原文链接: https://leetcode-cn.com/problems/subsets 英文原文Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1: Input: n…
原文链接: https://leetcode-cn.com/problems/word-search 英文原文Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells ar…
原文链接: https://leetcode-cn.com/problems/gray-code 英文原文An n-bit gray code sequence is a sequence of 2n integers where: Every integer is in the inclusive range [0, 2n - 1], The first integer is 0, An integer appears no more than once in the sequence, Th…
原文链接: https://leetcode-cn.com/problems/subsets-ii 英文原文Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example…
原文链接: https://leetcode-cn.com/problems/restore-ip-addresses 英文原文A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros. For example, "0.1.2.201" and "…
原文链接: https://leetcode-cn.com/problems/unique-binary-search-trees-ii 英文原文Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order. Examp…
原文链接: https://leetcode-cn.com/problems/path-sum-ii 英文原文Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of th…
原文链接: https://leetcode-cn.com/problems/word-ladder-ii 英文原文A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that: Every adjacent pair of words diff…
原文链接: https://leetcode-cn.com/problems/palindrome-partitioning 英文原文Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. A palindrome string is a string that reads …
原文链接: https://leetcode-cn.com/problems/word-break-ii 英文原文Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order. Note …
原文链接: https://leetcode-cn.com/problems/word-search-ii 英文原文Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells a…
原文链接: https://leetcode-cn.com/problems/combination-sum-iii 英文原文Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 through 9 are used. Each number is used at most once. Return a list o…
原文链接: https://leetcode-cn.com/problems/expression-add-operators 英文原文Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the…
原文链接: https://leetcode-cn.com/problems/remove-invalid-parentheses 英文原文Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return all the possible results. You may re…
原文链接: https://leetcode-cn.com/problems/additive-number 英文原文Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number …
原文链接: https://leetcode-cn.com/problems/binary-watch 英文原文A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the least significant bi…
原文链接: https://leetcode-cn.com/problems/matchsticks-to-square 英文原文You are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one square. You should not break any sti…
原文链接: https://leetcode-cn.com/problems/increasing-subsequences 英文原文Given an integer array nums, return all the different possible increasing subsequences of the given array with at least two elements. You may return the answer in any order. The given…
原文链接: https://leetcode-cn.com/problems/target-sum 英文原文You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all…
原文链接: https://leetcode-cn.com/problems/beautiful-arrangement 英文原文Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every i (1 <= i <= n), either of the fol…
1 / 3