Sorting the String in non - increasing Order
str . sort ( ) ; reverse ( str ) ; return str [ k - 1 ] ; } function reverse ( a ) { let i , n = a . length ; let t ; for ( i = 0 ; i < Math . floor ( n / 2 ) ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } return a ; }