Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I was asked the same question in an interview and they were epecting me to solve in O(n). Rest all solutions are solving in O(n^2) but this one is of order O(n).
This solution is wrong. It will never return 0, which is the answer for an array such as [20,10,-80,10,10,15,35]