반응형
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 | 29 | 30 |
31 |
Tags
- 쉬운 문제
- Algorithm
- 알고리즘
- 문자열
- 그래프
- HTTP 완벽 가이드
- typescript
- 타입 챌린지
- 수학
- 타입스크립트
- 프로그래머스
- javascript
- HTTP
- 백준
- dp
- Node.js
- 가천대
- ip
- 크롤링
- 레벨 1
- 자바스크립트
- 프로그래머스 레벨 2
- Crawling
- socket
- type challenge
- BFS
- Nestjs
- 소켓
- TCP
- dfs
Archives
- Today
- Total
kakasoo
[node.js] H-Index ( 프로그래머스 레벨2 ) 본문
반응형
// 프로그래머스 레벨2 H-Index를 풀었습니다.
function solution(citations) {
citations = citations.sort((o1, o2) => o1 - o2);
let maxV = 0;
let count = 1;
while (count <= citations[citations.length - 1]) {
let 이하 = citations.filter((e) => e <= count);
let 이상 = citations.filter((e) => e >= count);
//console.log(이상, count, 이하);
if (이상.length >= count && 이하.length <= count) {
maxV = count;
}
count++;
}
return maxV;
}
반응형
'프로그래밍 > 알고리즘 풀이' 카테고리의 다른 글
[node.js] 숫자의 표현 ( 프로그래머스 레벨2 ) (0) | 2021.06.29 |
---|---|
[node.js] 다음 큰 숫자 ( 프로그래머스 레벨2 ) (0) | 2021.06.29 |
[node.js] JadenCase ( 프로그래머스 레벨2 ) (0) | 2021.06.29 |
[node.js] 카펫 ( 프로그래머스 레벨2 ) (0) | 2021.06.29 |
[node.js] 타겟 넘버 ( 프로그래머스 레벨2 ) (0) | 2021.06.29 |