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?
Discussion 0
Join free to post in the discussion.
Related questions
- Range sum from a prefix arrayBackend Developer
- Compute a range sumBackend Developer
- Fast rectangle sums on a gridBackend Developer
- Many range increments at onceBackend Developer
- Running wallet balanceBackend Developer
- Cost of prefix sum queriesBackend Developer
- Average cost of a hash map lookupBackend Developer
- Worst case for a hash map lookupBackend Developer