๐๐ป 2022๋ 2์ 9์ผ
<script>
function solution(citations) {
var answer = 0;
citations.sort((a,b) => a-b);
for (let i=0; i<citations.length; i++) {
if (citations[i] === 0) continue;
let cnt = 0;
for (let j=i; j<citations.length; j++) {
if (citations[i] <= citations[j]) cnt++
if (cnt === citations[i]) break
}
answer = Math.max(answer, cnt);
}
return answer;
}
</script>