Problem
Input format
The first line contains two integers `n` and `k` separated by a space. The second line contains `n` integers separated by spaces. - `1 <= n <= 1000` - `-10^6 <= k <= 10^6` - `-1000 <= v[i] <= 1000` - each subarray must contain at least one element
Output format
Print a single natural number: the count of contiguous subarrays whose sum equals `k`, followed by a newline.
Example
5 7 1 2 3 4 5
1
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
5 7 1 2 3 4 5
1
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.