I am trying to find an O(n) solution to this problem:
Given an array, find the subarray with the sum closest to 0.
An O(nlogn) solution is kinda straightforward, but I have read this problem in a textbook in a context suggesting there's a O(n) solution. Any help?