Largest Subarray with Sum 0

00:00
MediumArrayHashMapPrefix Sum
AmazonAdobe

Find the length of the longest subarray with sum equal to 0.

Examples

Input → [15,-2,2,-8,1,7,10,23]
Output → 5
Note: subarray [-2,2,-8,1,7]
Input → [1,2,3]
Output → 0
Input → [0]
Output → 1