LeetCode: https://leetcode.com/problems/subarray-sum-equals-k/
Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals k.
1
0
2
1
1
2
2
3
1
4
k=3
pref=0
res=0
count={ 0 }
Step 1 / 7
Step 1:
Initialize count map with count[0]=1 (empty prefix). pref=0, res=0.
Pointers: i=-1
Focus: default
k=3pref=0res=0