Skip to content
RED SAG Skills
hard20 pts · first answer countshash-mapprefix-sums

First or last index of a prefix sum

To find the longest subarray with sum k, you store prefix sum → index. Why store only the first index of each sum?

Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions