Count the most common occurrence of subarray sum.
Constraints:
N <= 1e6; abs(ai) <= 1e6
Ex:
Inp:
5 1 1 2 1 4
Out:
3 (there are 3 subarray with the sum of 4: (1, 1, 2), (1, 2, 1), (4)
This question appears in ones of my friends competition and I have no idea how to solve it. Can someone help? Thanks.