If sum is negative , then maximum length substring is bin1 [ j + 1. . i ] , where sum of substring bin1 [ 0. . j ] is sum - 1.
elif ( sum <= 0 ) : NEW_LINE INDENT if ( ( sum - 1 ) in prevSum ) : NEW_LINE INDENT currlen = i - prevSum [ sum - 1 ] NEW_LINE maxlen = max ( maxlen , currlen ) NEW_LINE DEDENT DEDENT