You are using an outdated browser. Please update your browser for a better user experience.

Subarray with 0 sum


Given an array of integers, check if array contains a sub-array having 0 sum.

Input: {3,4,-7,3,1,3,1,-4,-2,-2}

Output: Sub-array with 0 sum exists

The sub-arrays with a sum of 0 are:







The problem doesn't need to display all the sub-arrays that have a sum of 0. But rather just say whether or not such a sub-array exists.