Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.
Input: An integer array nums and an integer k.
Output: Integer — count of subarrays with sum equal to k.
Input: [1,1,1],2
Output: 2
Explanation: Subarrays with sum 2: [1,1] at indices [0,1] and [1,2]. Count=2.Input: [1,2,3],3
Output: 2
Explanation: Subarrays: [3] at index 2 and [1,2] at indices [0,1]. Count=2.Input: [1,-1,1,-1,1],0
Output: 4
Explanation: Subarrays summing to 0: [1,-1],[1,-1,1,-1],[-1,1],[1,-1,1,-1,1]. Count=4.1 <= nums.length <= 2*10^4-1000 <= nums[i] <= 1000-10^7 <= k <= 10^7