Traverse through the map and check if its second element that is the frequency is odd or not . Then this is the odd occurring element . Its is clearly mentioned in problem that there are only two odd occurring elements so this will print those two elements .
document . write ( " " ) ; let ar = [ ] for ( let x of m ) { if ( x [ 1 ] % 2 != 0 ) ar . push ( x [ 0 ] ) } document . write ( ` ${ ar . reverse ( ) } ` ) }