https://programmers.co.kr/learn/courses/30/lessons/42747
π λ¬Έμ
π μ νμ¬ν
π» μ½λ
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
class Solution {
public int solution(int[] citations) {
int answer = 0;
Arrays.sort(citations);
List<Integer> list = new ArrayList<>();
for (int i = citations.length - 1; i >= 0; i--) {
list.add(citations[i]);
}
for (int i = 0; i < list.size(); i++) {
if (i + 1 <= list.get(i)) {
if (i + 1 == list.get(i)) {
answer = i + 1;
break;
} else answer = i + 1;
}
}
return answer;
}
}
π‘ μ 리νκΈ°
π λ¬Έμ μ€λͺ
λ§ λ³΄κ³ μ½λλ₯Ό μ§λκΉ κ³μ νλ¦° λ΅μ΄ λμμλ€. μν€νΌλμ λ³Ό μκ°μ μ νμλλ° λ€μ΄κ°λ³΄λκΉ h-indexλ₯Ό ꡬνλ λ°©λ²μ΄ μ λμμμλ€. ' μΈλ±μ€ κ°λ³΄λ€ μμμ§κΈ° μμνλ μκ° h-indexλ€ ' λΌλ λ§μ κ½νμ κ³μ νλ Έμλ€.