Insert all votes in a hashmap
let map = new Map ( ) ; for ( let i = 0 ; i < votes . length ; i ++ ) { if ( map . has ( votes [ i ] ) ) { map . set ( votes [ i ] , map . get ( votes [ i ] ) + 1 ) ; } else map . set ( votes [ i ] , 1 ) ; }