티스토리 뷰
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import java.util.Arrays;
public class Level2_HIndex {
public static int solution(int[] citations) {
Arrays.sort(citations);
int hIndex = 0;
int n = citations.length;
for (int i = 0; i < n; i++) {
int h = n - i;
if (citations[i] >= h) {
hIndex = h;
break;
}
}
return hIndex;
}
public static void main(String[] args) {
int[] citations = {3, 0, 6, 1, 5};
System.out.println(solution(citations));
}
}
|
cs |
문제 이해가 잘 안가서 찾아서 풀었다.
아직도 좀 헷갈린다.
h 는 citations[] 배열의 수가 아니여도 된다.
n편의 논문중 h 번 이상 인용된 논문이 h 편 이상인 h 의 최댓값을 찾는다.
'PS > programmers' 카테고리의 다른 글
MySQL 1레벨 다 풀었다. (0) | 2021.08.06 |
---|---|
Level2) 카펫 (0) | 2021.07.13 |
Level2) 위장 (0) | 2021.05.03 |
Level1) 내적 (0) | 2021.05.02 |
Level1) 폰켓몬 (0) | 2021.05.01 |
링크
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- REST API
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- HTTP 완벽가이드
- GCP
- 킹수빈닷컴
- 김영한 http
- JPA 연관관계 매핑
- 드림코딩
- js promise
- http
- java
- 모던자바스크립트
- 이펙티브자바
- 이펙티브자바 스터디
- 이펙티브자바 아이템59
- js api
- HTTP 완벽 가이드
- BOJ
- 프로그래머스 SQL
- 이펙티브자바 아이템60
- 백기선 스터디
- Spring Security
- ㅇㄷㅇㅈ
- js array
- 프로그래머스
- 패스트캠퍼스 컴퓨터공학 완주반
- JS 딥다이브
- 김영한 JPA
- dreamcoding
- 백준
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함