Concept Flow - Subarray Sum Equals K Using Hash Map
Start with sum=0 and map={0:1}
Iterate over array elements
Add current element to sum
Check if (sum-k) exists in map?
Add map[sum-k
Update map with current sum count
Repeat for next element
Return total count of subarrays
We keep a running sum and use a map to count how many times each sum appears. For each element, we check if sum-k was seen before to find subarrays summing to k.
