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