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