Skip to content

Commit

Permalink
update cheatsheet, progress
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Dec 8, 2024
1 parent 050601d commit c10e7bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/progress.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
20241208: 304,853,325
20241208: 304,853,325,560(todo)
20241202: 370(todo),1109(todo)
20241130: 34,767
20241126: 722,380
Expand Down
11 changes: 11 additions & 0 deletions doc/cheatsheet/hash_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
- `TODO : note this as pattern!!!`
- LC 325: Maximum Size Subarray Sum Equals k
- `prefix sum` + hashmap
```
subarray[i,j] = prefixSum[j] - prefixSum[i-1]
so, to find a subarray equals k
-> prefixSum[j] - prefixSum[i-1] = k
-> prefixSum[j] - k = prefixSum[i-1]
-> so all need to do is : check if "prefixSum[j] - k" is in map
```
- Any problems with below:
- need to cache
- avoid double loop
Expand Down

0 comments on commit c10e7bf

Please sign in to comment.