Compare temp [ i ] with distance of its last occurence from the end of the array and store the maximum
if ( temp [ i ] != - 1 ) : NEW_LINE INDENT temp [ i ] = max ( temp [ i ] , n - mp [ i ] ) NEW_LINE DEDENT