Given an integer array and an integer , return the total number of subarrays whose sum equals . You're solving the textbook prefix sum + hash map problem.
The combination gives time. Note: the array can contain negative numbers, so the simple sliding window approach doesn't work.