Given an array of +ve and -ve no. where +ve number represents earning and -ve represents expenditure.

You can move the -ve values at the end which is considered as one operation.

Find the minimum no of operations req. such that sum of array never reaches -ve

U can assume that sum of total array is always non negative.

N = [1,100000]

A[i] =[-100000,100000]

Exp

Arr = 10,-10,1,-2,-1,-2,4

Ans = 1 as moving -10 would be enough to make sure the sum of array at any point is non negative.

Now able find an efficient soln.

Recursion would produce tle .