문제 이해가 안가서 시간이 좀 걸렸다.
구현은 쉬웠던 문제.
#include <vector>
#include <algorithm>
using namespace std;
bool compare(int a, int b)
{
return a > b;
}
int solution(vector<int> citations) {
sort(citations.begin(), citations.end(), compare);
for (int i = 0; i < citations.size(); i++)
if (citations[i] <= i)
return i;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV2 큰 수 만들기 (0) | 2022.05.30 |
|---|---|
| [프로그래머스] (C++) LV2 카펫 (0) | 2022.05.28 |
| [프로그래머스] (C++) LV2 다리를 지나는 트럭 (0) | 2022.05.26 |
| [프로그래머스] (C++) LV2 위장 (0) | 2022.05.26 |
| [프로그래머스] (C++) LV2 배달 (0) | 2022.05.25 |