Problem 560 · Medium
Prefix sum with a hash map: count[prefixSum - k] gives the number of valid subarrays ending here.
Open the interactive visualisation