Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 테코테코
- 매일메일
- Get
- 자바
- 알고리즘
- programmers
- react
- json-server
- C++
- JavaScript
- react-redux
- maeil-mail
- Algorithm
- 리액트
- react-router
- SW
- sw expert academy
- 이코테
- redux
- redux-saga
- Python
- createSlice
- useDispatch
- redux-toolkit
- 프로그래머스
- 항해플러스
- 코딩테스트합격자되기
- 항해99
- java
- axios
Archives
- Today
- Total
Binary Journey
[프로그래머스] H-Index 본문
반응형
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges
** Javascript
풀릴 줄 몰랐는데 풀렸다 ㅋㅋㅋㅋ
근데 시간이 오래 걸렸다
내가 H-Index의 개념을 모르고 문제 설명대로 풀어서 그런 것 같다.
일단 나의 풀이는 이렇다.
function solution(citations) {
return citations.reduce((acc, curr) => {
let h = citations.filter((논문) => 논문 >= curr).length;
let isHIndex = curr >= h && citations
.filter((논문) => 논문 < curr)
.every((논문) => 논문 <= h );
if (isHIndex) acc = h;
return acc;
}, 0);
}
논문 말고 인용으로 인스턴스를 쓸 걸 그랬다.
반응형
'프로그래머스 > level 2' 카테고리의 다른 글
[프로그래머스][위클리챌린지] 5주차 모음 사전 (0) | 2021.09.02 |
---|---|
[프로그래머스] Jaden Case 문자열 만들기 (0) | 2021.08.14 |
[프로그래머스] 최댓값과 최솟값 (0) | 2021.08.10 |
[프로그래머스] 최솟값 만들기 (0) | 2021.08.10 |
[프로그래머스] N개의 최소공배수 (0) | 2021.08.10 |