Count the most common occurrence of subarray sum.

Revision en2, by Loserinlife, 2023-06-03 14:16:15

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Loserinlife 2023-06-03 14:16:36 2 Tiny change: 'np:\n\n5\n1 1 2 1 ' -> 'np:\n\n5\n\n1 1 2 1 '
en2 English Loserinlife 2023-06-03 14:16:15 11
en1 English Loserinlife 2023-06-03 14:15:17 367 Initial revision (published)