If this is true then this character is being visited for the first time from the last Thus last occurrence of this character is stored in this index
loccur [ chI ] = i ; } } let sorted_s = s ; sorted_s . sort ( ) ; for ( let i = 0 ; i < len ; ++ i ) { if ( s [ i ] != sorted_s [ i ] ) {