S
All challenges
Practice
Home
Blog
Practice
Examples
Feedback
Largest Subarray with Sum 0
00:00
Start
00:00
Sign in
Problem
Hints
3
Solution
History
Medium
Array
HashMap
Prefix Sum
Amazon
Adobe
Find the length of the longest subarray with sum equal to 0.
Examples
Example 1
Input →
[15,-2,2,-8,1,7,10,23]
Output →
5
Note:
subarray [-2,2,-8,1,7]
Example 2
Input →
[1,2,3]
Output →
0
Example 3
Input →
[0]
Output →
1
JavaScript
Python
Java (Coming soon)
C (Coming soon)
C++ (Coming soon)
Reset
Run
Submit
Cases
Results