Skip to content

Commit c10e7bf

Browse files
committed
update cheatsheet, progress
1 parent 050601d commit c10e7bf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

data/progress.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
20241208: 304,853,325
1+
20241208: 304,853,325,560(todo)
22
20241202: 370(todo),1109(todo)
33
20241130: 34,767
44
20241126: 722,380

doc/cheatsheet/hash_map.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
- `TODO : note this as pattern!!!`
4545
- LC 325: Maximum Size Subarray Sum Equals k
4646
- `prefix sum` + hashmap
47+
```
48+
subarray[i,j] = prefixSum[j] - prefixSum[i-1]
49+
50+
so, to find a subarray equals k
51+
52+
-> prefixSum[j] - prefixSum[i-1] = k
53+
54+
-> prefixSum[j] - k = prefixSum[i-1]
55+
56+
-> so all need to do is : check if "prefixSum[j] - k" is in map
57+
```
4758
- Any problems with below:
4859
- need to cache
4960
- avoid double loop

0 commit comments

Comments
 (0)