Perform Binary search
while ( r - l > 0 ) : NEW_LINE INDENT tm = ( l + r + 1 ) // 2 NEW_LINE if ( check ( tm , a ) ) : NEW_LINE INDENT l = tm NEW_LINE DEDENT else : NEW_LINE INDENT r = tm - 1 NEW_LINE DEDENT DEDENT return l NEW_LINE