典型backtrack回顾
context
我觉得面试很大概率会让写回溯的题目,这边摘抄一些别人的解答。
1 | Input: nums = [1,2,3] |
1 | class Solution { |
1 | Input: [1,2,2] |
1 | class Solution { |
1 | Input: [1,2,3] distinct |
1 | class Solution { |
1 | Input: [1,1,2] |
1 | class Solution { |
1 | Input: candidates = [2,3,6,7], target = 7, |
1 | public List<List<Integer>> combinationSum(int[] nums, int target) { |
1 | Input: candidates = [2,5,2,1,2], target = 5, |
1 | public List<List<Integer>> combinationSum2(int[] nums, int target) { |