uploaded at 2022. 12. 26. 오후 8:06:22

This commit is contained in:
rl544
2022-12-26 20:06:24 +09:00
parent b958d48a60
commit 4471d2b9ea
+18
View File
@@ -0,0 +1,18 @@
// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/42747
import java.util.Arrays;
class Solution {
public int solution(int[] citations) {
int answer = 0;
int mlen = citations.length;
Arrays.sort(citations);
for(int c = (citations.length+1)/2; c <= mlen; c++){
if(citations[mlen-c] >= c) {
answer = c;
System.out.println(c + " " + citations[mlen-c]);
} else break;
}
System.out.println(Arrays.toString(citations));
return answer;
}
}