우선 문제를 이해하는데 한참이 걸렸다.. 뭔 소리인지 알아도 예시를 들자하니 또 막히고 결국 찾아보다 좋은 블로그가 있었다.
https://www.ibric.org/myboard/read.php?Board=news&id=270333
문제를 이해하니 푸는 건 매우 쉬웠다. 그저 index와 피인용수의 값을 비교하면 됐던 문제
function solution(citations) {
let ans = 0;
citations.sort( (a,b) => b-a)
for (i=0; i<citations.length; i++) {
if (i < citations[i]) {
ans++
}
}
return ans
}