File tree Expand file tree Collapse file tree 2 files changed +15
-20
lines changed
Expand file tree Collapse file tree 2 files changed +15
-20
lines changed Original file line number Diff line number Diff line change 1+ import java .util .*;
2+
13class Solution {
24 public int solution (int [] citations ) {
35 int answer = 0 ;
4- int arr [] = new int [citations .length +1 ];
56
6- for (int i : citations )
7- {
8- int cur =i ;
9- if (cur > citations .length )
10- cur = citations .length ;
11-
12- arr [cur ]++;
13- }
14- int sum =0 ;
15- for (int i = arr .length -1 ; i >=1 ; i --)
16- {
17- sum += arr [i ];
7+ Arrays .sort (citations );
8+
9+ for (int i =0 ; i <citations .length ; i ++) {
10+ int cur = citations [i ];
1811
19- if (sum >= i )
20- {
21- answer = i ;
12+ if (citations .length - i <= cur ) {
13+ answer = citations .length -i ;
2214 break ;
2315 }
24- }
16+ }
2517 return answer ;
2618 }
27- }
19+ }
20+
21+ //0 1 3 5 6
22+ //1 2 5 6 7
Original file line number Diff line number Diff line change 44
55### 성능 요약
66
7- 메모리: 77.3 MB, 시간: 0.06 ms
7+ 메모리: 92.6 MB, 시간: 0.89 ms
88
99### 구분
1010
1616
1717### 제출 일자
1818
19- 2024년 07월 30일 10:04:44
19+ 2025년 11월 10일 20:59:09
2020
2121### 문제 설명
2222
You can’t perform that action at this time.
0 commit comments