Finding the largest index for which A [ i ] != B [ i ] i . e the ending index of the unequal sub - array
for i in range ( N - 1 , - 1 , - 1 ) : NEW_LINE INDENT if ( A [ i ] != B [ i ] ) : NEW_LINE INDENT end = i NEW_LINE break NEW_LINE DEDENT DEDENT