프린터
2020.07.29
const mapHelper = (priority, idx) => {
return [priority, idx];
};
const solution = (priorities, location) => {
const entries = priorities.map(mapHelper);
let count = 0;
while (entries.length) {
const current = entries.shift();
const bigger = entries.find(([priority, idx]) => {
if (priority > current[0]) {
return true;
}
});
if (bigger) {
entries.push(current);
continue;
}
count++;
if (current[1] == location) {
return count;
}
}
};
- 좋아요를 가장 많이 받은 풀이랑 접근법이 똑같은 거 같은데 왜 내 풀이가 더 느린지 모르겠다...