Practice
Learn
← Quit
0 / 0 correct
Algorithms
Hard
1 of 632
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
Two nested loops
C
Sort the array first
D
Use a sliding window only