Last Minute Notes
Github
Docs
Learn
Search
⌘
K
@sayanstwt
Lessons
Learn
/
Data Structures & Algorithms
/
Arrays & Strings
Prefix Sum & Hash Map
7 min
Intermediate
8 steps
Count subarrays that sum to k, even with negative numbers.
k
0
Window sum
1
Grow by one
first element
sum 1
0
1
2
1
-1
0
current
done
skipped
In this lesson
Step 1 of 8
1
The problem
2
Prefix
3
Range sum
4
Look back
5
Hash map
6
The seed
7
Negatives
8
Recap