Skip to content

Commit

Permalink
update 39 java, update progress
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Feb 29, 2024
1 parent 6a1e7c6 commit 6cf7645
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
3 changes: 2 additions & 1 deletion data/progress.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
20240229: 39
20240228: 20,21,23,33(again)
20240227: 1,3,5,4,19
20231218: 57(todo),58(todo),268,61(todo),297
20231218: 57(todo),58(todo),268,61(stodo),297
20231211: 39,53,48,56
20231208: 33
20231206: 19,003
Expand Down
30 changes: 18 additions & 12 deletions data/to_review.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
2024-04-24 -> ['39']
2024-04-23 -> ['20,21,23,33(again)']
2024-04-22 -> ['1,3,5,4,19']
2024-04-03 -> ['39']
2024-04-02 -> ['20,21,23,33(again)']
2024-04-01 -> ['1,3,5,4,19']
2024-03-21 -> ['39']
2024-03-20 -> ['20,21,23,33(again)']
2024-03-19 -> ['1,3,5,4,19']
2024-03-13 -> ['39']
2024-03-12 -> ['20,21,23,33(again)']
2024-03-11 -> ['1,3,5,4,19']
2024-03-08 -> ['39']
2024-03-07 -> ['20,21,23,33(again)']
2024-03-06 -> ['1,3,5,4,19']
2024-03-05 -> ['39']
2024-03-04 -> ['20,21,23,33(again)']
2024-03-03 -> ['1,3,5,4,19']
2024-03-02 -> ['20,21,23,33(again)']
2024-03-01 -> ['20,21,23,33(again)', '1,3,5,4,19']
2024-03-03 -> ['39', '1,3,5,4,19']
2024-03-02 -> ['39', '20,21,23,33(again)']
2024-03-01 -> ['39', '20,21,23,33(again)', '1,3,5,4,19']
2024-02-29 -> ['20,21,23,33(again)', '1,3,5,4,19']
2024-02-28 -> ['1,3,5,4,19']
2024-02-11 -> ['57(todo),58(todo),268,61(todo),297']
2024-02-11 -> ['57(todo),58(todo),268,61(stodo),297']
2024-02-04 -> ['39,53,48,56']
2024-01-30 -> ['19,003']
2024-01-29 -> ['23']
2024-01-28 -> ['55,45']
2024-01-21 -> ['57(todo),58(todo),268,61(todo),297']
2024-01-21 -> ['57(todo),58(todo),268,61(stodo),297']
2024-01-14 -> ['39,53,48,56']
2024-01-09 -> ['19,003']
2024-01-08 -> ['57(todo),58(todo),268,61(todo),297', '23']
2024-01-08 -> ['57(todo),58(todo),268,61(stodo),297', '23']
2024-01-07 -> ['55,45']
2024-01-02 -> ['452,406,135']
2024-01-01 -> ['39,53,48,56']
2023-12-31 -> ['57(todo),58(todo),268,61(todo),297', '134']
2023-12-31 -> ['57(todo),58(todo),268,61(stodo),297', '134']
2023-12-28 -> ['53']
2023-12-27 -> ['19,003']
2023-12-26 -> ['57(todo),58(todo),268,61(todo),297', '23']
2023-12-26 -> ['57(todo),58(todo),268,61(stodo),297', '23']
2023-12-25 -> ['55,45']
2023-12-24 -> ['39,53,48,56']
2023-12-23 -> ['57(todo),58(todo),268,61(todo),297']
2023-12-21 -> ['57(todo),58(todo),268,61(todo),297']
2023-12-20 -> ['57(todo),58(todo),268,61(todo),297']
2023-12-19 -> ['57(todo),58(todo),268,61(todo),297', '39,53,48,56', '19,003']
2023-12-23 -> ['57(todo),58(todo),268,61(stodo),297']
2023-12-21 -> ['57(todo),58(todo),268,61(stodo),297']
2023-12-20 -> ['57(todo),58(todo),268,61(stodo),297']
2023-12-19 -> ['57(todo),58(todo),268,61(stodo),297', '39,53,48,56', '19,003']
2023-12-18 -> ['23']
2023-12-17 -> ['55,45']
2023-12-16 -> ['39,53,48,56']
Expand Down
7 changes: 6 additions & 1 deletion doc/cheatsheet/backtrack.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@
else{
for(int i = start; i < nums.length; i++){
tempList.add(nums[i]);
backtrack(list, tempList, nums, remain - nums[i], i); // not i + 1 because we can reuse same elements
/** NOTE !!!
*
* use i, since we need to use start from current (i) index in recursion call
* (reuse current index)
*/
backtrack(list, tempList, nums, remain - nums[i], i);
tempList.remove(tempList.size() - 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public List<List<Integer>> combinationSum(int[] candidates, int target) {
return null;
}

// NOTE !!! we sore here
Arrays.sort(candidates);

List<List<Integer>> res = new ArrayList<>();
Expand Down Expand Up @@ -46,7 +47,11 @@ private void backTrack(int[] candidates, int target, List<Integer> tmp, List<Lis
for (int i = idx; i < candidates.length; i++){
int cur = candidates[i];
tmp.add(cur);
/** NOTE !!! need to use start from i index in recursion call */
/** NOTE !!!
*
* use i, since we need to use start from current (i) index in recursion call
* (reuse current index)
*/
backTrack(candidates, target, tmp, res, i);
// undo
tmp.remove(tmp.size()-1);
Expand Down

0 comments on commit 6cf7645

Please sign in to comment.