반응형
반응형
https://school.programmers.co.kr/learn/courses/30/lessons/42747
문제 요약
H-Index를 반환하는 함수 만들기
풀이
using System;
using System.Linq;
public class Solution {
public int solution(int[] citations) {
int answer = 0;
for(int i = citations.Length; i > 0; i--)
{
var num = citations.Where(x => x >= i).Count();
if (num >= i)
{
answer = i;
break;
}
}
return answer;
}
}
비상계엄령 선포
반응형
'Algorithm > Programmers' 카테고리의 다른 글
[C#]프로그래머스 87390 n^2 배열 자르기 - Hide (1) | 2024.12.11 |
---|---|
[C#]프로그래머스 120956 옹알이 (1) - Hide (0) | 2024.12.05 |
[C#]프로그래머스 12949 행렬의 곱셈 - Hide (0) | 2024.12.01 |
[C#]프로그래머스 42840 모의고사 - Hide (0) | 2024.11.30 |
[C#]프로그래머스 136798 기사단원의 무기 - Hide (0) | 2024.11.29 |