Order queue has K most frequent strings in a reverse order
var ans = [ ] ; Order . sort ( ( a , b ) => a [ 0 ] - b [ 0 ] ) ; while ( Order . length != 0 ) { ans . push ( Order [ Order . length - 1 ] ) Order . pop ( ) ; }