Largest Continuous Sequence Zero Sum

Find the largest continuous sequence in a array which sums to zero.

Example:


Input:  {1 ,2 ,-2 ,4 ,-4}
Output: {2 ,-2 ,4 ,-4}

NOTE : If there are multiple correct answers, return the sequence which occurs first in the array.

Interview Code Editor
Hints
  • Hint 1
  • Solution Approach
  • Complete Solution
2458 successful submissions.
Asked In:
  • Microsoft
Click here to jump start your coding interview preparation