Return the length of the longest contiguous run of nums whose values add up to 0, or 0 if there is none. Values can be negative.
The starter code tries every start and end. It is correct but too slow. Make it fast.
Example 1
Input:
longest_zero_sum_subarray([15, -2, 2, -8, 1, 7, 10, 23])
Output:
5
The run [-2, 2, -8, 1, 7] adds to 0 and has length 5.
Example 2
Input:
longest_zero_sum_subarray([1, 2, 3])
Output:
0
No run adds to 0.
0 <= len(nums) <= 2 * 10**5-10**4 <= nums[i] <= 10**4No results yet
Run your code to check it against the examples, or submit to run every test.