Practice
Learn
← Quit
0 / 0 correct
Algorithms
Hard
1 of 20
How do prefix sums count subarrays with sum exactly k in O(n)?
A
Track counts of prefix sums in a hash map; for each prefix p, add count[p − k]
B
Sort the array first
C
Use a sliding window only
D
Two nested loops