Level 2. H-Index

<cpp />
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations)
{
for (int i = *max_element(citations.begin(), citations.end()); 0 <= i ; --i)
{
int t = 0;
for (int cit : citations)
t += (i <= cit);
if (i <= t)
return i;
}
}
'자료구조 & 알고리즘 > 프로그래머스' 카테고리의 다른 글
Level 2. [3차] n진수 게임 (0) | 2023.06.02 |
---|---|
Level 2. 점프와 순간 이동 (0) | 2023.06.01 |
Level 2. 멀리 뛰기 (0) | 2023.05.30 |
Level 2. 점 찍기 (0) | 2023.05.29 |
Level 0. 특별한 이차원 배열 1 (0) | 2023.05.28 |