Lv.2 H-index

ujinujinยท2022๋…„ 2์›” 9์ผ
0

๐Ÿค–๋ฌธ์ œ

๐Ÿ‘๐Ÿป 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>
profile
๋ฐฑ์ˆ˜์™€ ์ทจ์ค€์ƒ ๊ทธ ์‚ฌ์ด ์–ด๋””

0๊ฐœ์˜ ๋Œ“๊ธ€

๊ด€๋ จ ์ฑ„์šฉ ์ •๋ณด