Try
[Programmers/C++] H-Index 본문
출처
https://has3ong.tistory.com/manage/newpost/?type=post&returnURL=%2Fmanage%2Fposts
TISTORY
나를 표현하는 블로그를 만들어보세요.
www.tistory.com
소스
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
int answer = 0;
sort(citations.begin(), citations.end());
reverse(citations.begin(), citations.end());
for (int i = 0; i < citations.size(); i++)
{
if (i + 1 > citations[i])
{
answer = i;
return answer;
}
}
}
'Algorithm > Programmers' 카테고리의 다른 글
[Programmers/C++] 문자열 내 p와 y의 개수 (0) | 2019.04.12 |
---|---|
[Programmers/C++] 올바른 괄호 (0) | 2019.04.07 |
[Programmers/C++] 짝지어 제거하기, 효율성1,2,3,4 오류 (0) | 2019.04.07 |
[Programmers/C++] 예상 대진표 (0) | 2019.04.04 |
[Programmers/Python] 폰켓몬 (0) | 2019.04.04 |
Comments