Given an array of integers (which may include negative numbers) and a target k, count how many contiguous subarrays sum to exactly k.
Example 1
Explanation: Two subarrays sum to 2: [1,1] (indices 0-1) and [1,1] (indices 1-2).
Example 2
Explanation: [1,2] and [3] both sum to 3.
Example 3
Explanation: With a negative number present, [1,-1], [1,-1,0], and [0] all sum to 0 — a plain sliding window would fail here because shrinking the window on a negative number can increase the sum instead of decreasing it.
Code execution is coming soon.