AdvancedRating 1500
Subarrays Summing to K
Count the contiguous subarrays whose sum equals k. Values may be negative.
Input
n k, then n integers.
Output
A count.
Sample 1
Input
3 2 1 1 1
Output
2
Sample 2
Input
3 3 1 2 3
Output
2
Output appears heren k, then n integers.
A count.
3 2 1 1 1
2
3 3 1 2 3
2
Output appears here