随笔分类 -  dfs backtracking

79. Word Search
摘要: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 "adjac 阅读全文

posted @ 2018-07-18 08:10 猪猪🐷

17. Letter Combinations of a Phone Number
摘要:A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Example: For static final, 阅读全文

posted @ 2018-07-18 08:09 猪猪🐷

784. 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 stri 阅读全文

posted @ 2018-07-18 08:08 猪猪🐷

216. Combination Sum III
摘要: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 阅读全文

posted @ 2018-07-18 08:07 猪猪🐷

40. Combination Sum II
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb 阅读全文

posted @ 2018-07-18 08:06 猪猪🐷

39. Combination Sum
摘要:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the 阅读全文

posted @ 2018-07-18 08:04 猪猪🐷

77. Combinations
摘要:我写的 [1,4] is the same as [4,1] in the combination sense because in combination ,[1,4] is the same as [4,1], so we want to sort the array first and 1,1 阅读全文

posted @ 2018-07-18 08:01 猪猪🐷

22. Generate Parentheses
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: ( 阅读全文

posted @ 2018-07-18 07:48 猪猪🐷

46. Permutations
摘要:solution 2 : (1) used hashset to record used elements and pass the hashset for the next level on the current level, we need to do the backtrack recove 阅读全文

posted @ 2018-07-18 07:47 猪猪🐷

90. Subsets II
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta 阅读全文

posted @ 2018-07-18 07:46 猪猪🐷

78. Subsets
摘要:(面经 Find the number of subsets which the sum of min value in subset and max value in subset smaller or equal to the given target) https://www.journald 阅读全文

posted @ 2018-07-18 07:34 猪猪🐷

导航