https://school.programmers.co.kr/learn/courses/30/lessons/42889?language=javascript
function solution(N, stages) {
let M = new Map();
let total = stages.length;
for(let i = 1; i < N+1; i++){
let temp = stages.filter((e)=>e===i).length;
M.set(i, temp/total);
total-=temp;
}
let answer = [...M].sort((a,b)=>b[1]-a[1]).map(e=>e[0]);
return answer;
}