![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
backtracking
鸡蛋豆腐仙子
从本科开始讨厌了单片机 晶体管 编程 c++5-6年后,发现技术就是我的真爱,再重新选择一次,我还是会选择当程序员。我现在觉得自己什么都不会,可是还是相信会变成别人仰望的大神。
展开
-
【刷题】leetcode 113 path sum II
Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / 11 13 4 / \ / 7 2 5 1 Return: [ [5,4,11,2], [5,8,4,5] ] /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; *原创 2020-10-08 15:12:53 · 79 阅读 · 0 评论 -
【刷题】Leetcode 131. Palindrome Partitioning
Example: Input: “aab” Output: [ [“aa”,“b”], [“a”,“a”,“b”] ] 搜索顺序 a a b a ab aa b aab class Solution { public List<List<String>> partition(String s) { List<List<String>...原创 2019-10-30 21:08:18 · 76 阅读 · 0 评论 -
【刷题】Leetcode 784. Letter Case Permutation
Examples: Input: S = “a1b2” Output: [“a1b2”, “a1B2”, “A1b2”, “A1B2”] Input: S = “3z4” Output: [“3z4”, “3Z4”] Input: S = “12345” Output: [“12345”] class Solution { public List<String> letter...原创 2019-10-28 16:51:37 · 69 阅读 · 0 评论 -
【刷题Leetcode 39. Combination Sum
Example 1: Input: candidates = [2,3,6,7], target = 7, A solution set is: [ [7], [2,2,3] ] 在combination基础上刷这道题,主要是递归层数这个地方。 for(int i = n; i < candidates.length; i++){ list.add(candidates[i]); helpe...原创 2019-10-27 16:15:35 · 76 阅读 · 0 评论 -
【刷题】Leetcode 46. Permutations
这道题还比较顺利,10-15分钟的样子可以搞定。 Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] class Solution { public List<List<Integer>> permute(int[] nums) { ...原创 2019-10-26 20:36:09 · 98 阅读 · 0 评论 -
【刷题】Leetcode 77. Combinations
Example: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] class Solution { public List<List<Integer>> combine(int n, int k) { List<List&...原创 2019-10-26 19:07:22 · 58 阅读 · 0 评论