| Topic | Difficulty | Companies |
|---|---|---|
| Hash Table | HARD | Microsoft |
Given an array arr of n integer elements, write a program to find the length of the longest subarray with sum equals to 0.
Problem Note
Example 1
Input: arr[] = [15, -2, 0, -8, 3, 7, 10, 23]
Output: 5
Explanation: The largest subarray with 0 sum is [-2, 0, -8, 3, 7]
Example 2
Input: arr[] = [1, 2, 3]
Output: 0
Explanation: There is no subarray with 0 sum.