LeetCode 169 Majority Element | JavaScript Solution | Top Interview Questions Easy

preview_player
Показать описание
LeetCode 169 Majority Element | JavaScript Solution | Top Interview Questions Easy
Рекомендации по теме
Комментарии
Автор

instead of lopping through the hash map just turn it into an array then sort it by appearances number then get the first element



     return result.sort((a, b)=>b[1]-a[1])[0][0]

n_fan