Find the largest subarray with sum of 0 in the given array
Problem
An array contains both positive and negative elements, find the largest subarray whose sum equals 0.
Example
int[] input = {4, 6, 3, -9, -5, 1, 3, 0, 2}
int output = {4, 6, 3, -9, -5, 1} of length 6
Solution Method 1 - Brute force
This is simple. Will write later (incomplete)
Method 2 - Storing the sum upto ith element in temp array
Given an int[] input array, you can create an int[] tmp array where
[Read More]