Finding the 1 st element which is not equal to the kth element
for i in range ( k - 2 , - 1 , - 1 ) : NEW_LINE INDENT if ( a [ i ] != a [ k - 1 ] ) : NEW_LINE INDENT return i + 1 NEW_LINE DEDENT DEDENT