If sum is less than 0 , then find if there is a prefix array having sum that needs to be added to current sum to make its value greater than or equal to 0. If yes , then compare length of updated subarray with maximum length found so far
else : NEW_LINE INDENT ind = findInd ( preSum , n , total ) NEW_LINE if ( ind != - 1 ) & ( minInd [ ind ] < i ) : NEW_LINE INDENT maxlen = max ( maxlen , i - minInd [ ind ] ) NEW_LINE DEDENT DEDENT return maxlen NEW_LINE