LeetCode-回溯
文章平均质量分 51
Euadvancer
代码才是真爱
展开
-
401. Binary Watch -Easy
Question 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 signi原创 2017-02-20 22:54:55 · 333 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number -Medium
Question Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below.原创 2017-02-23 20:40:26 · 590 阅读 · 0 评论 -
22. Generate Parentheses -Meidum
Question Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 给出一对括号,请你生成所有良好格式的组合(每个开括号后总有一个闭括号对应,比错误示例:“)(”)Example given n = 3, a solutio原创 2017-02-23 19:48:53 · 413 阅读 · 0 评论 -
40. Combination Sum II -Medium
Question Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in t原创 2017-02-23 16:07:52 · 428 阅读 · 0 评论 -
39. Combination Sum -Medium
Question Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may原创 2017-02-23 12:56:49 · 418 阅读 · 0 评论 -
47. Permutations II -Medium
Question Given a collection of numbers that might contain duplicates, return all possible unique permutations. 给出一个可能包含重复数字的数组,请你返回所有可能的组合(组合不能重复)Example [1,1,2] have the following unique per原创 2017-02-23 11:34:57 · 615 阅读 · 0 评论 -
46. Permutations -Medium
Question Given a collection of distinct numbers, return all possible permutations. 给出一个无重复数字的集合,返回所有的组合Example [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2原创 2017-02-23 10:54:20 · 342 阅读 · 0 评论 -
60. Permutation Sequence -Medium
Question The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): 1. “123”原创 2017-02-22 22:33:57 · 399 阅读 · 0 评论 -
77. Combinations -Medium
Question Given two integers n and k, return all possible combinations of k numbers out of 1 … n. 给出两个整数n和k,返回所有可能的由K个1…n中的元素的组合Example If n = 4 and k = 2, a solution is: [ [2,4],原创 2017-02-22 18:28:32 · 305 阅读 · 0 评论 -
78. Subsets -Medium
Question Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. 给出一个无重复整数的集合nums,返回所有可能的子集(子集不能重复)Example If nums原创 2017-02-22 17:53:56 · 357 阅读 · 0 评论 -
79. Word Search -Medium
Question Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally o原创 2017-02-22 17:36:13 · 309 阅读 · 0 评论 -
90. Subsets II -Medium
Question Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. 给出一个保护重复数字的整形数组nums,请你返回原创 2017-02-21 21:14:28 · 326 阅读 · 0 评论 -
93. Restore IP Addresses -Medium
Question Given a string containing only digits, restore it by returning all possible valid IP address combinations. 给出一个仅包含数字的字符串,返回所有可靠的IP的组合Example Given “25525511135”, return [“255.25原创 2017-02-21 20:09:28 · 294 阅读 · 0 评论 -
131. Palindrome Partitioning -Medium
Question Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 给出一个字符串s,将s分割为回文字串,返回所有的分割方法Example g原创 2017-02-21 18:53:59 · 384 阅读 · 0 评论 -
216. Combination Sum III -Medium
Question Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. 找出K个数字总和为n原创 2017-02-21 16:31:45 · 423 阅读 · 0 评论 -
526. Beautiful Arrangement -Medium
Question Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of the following is true for the ith positio原创 2017-02-23 21:57:09 · 537 阅读 · 0 评论