반응형
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
- 소켓
- dp
- javascript
- 문자열
- Nestjs
- 쉬운 문제
- 알고리즘
- Crawling
- 프로그래머스 레벨 2
- dfs
- socket
- 백준
- 가천대
- 자바스크립트
- type challenge
- typescript
- 수학
- HTTP
- HTTP 완벽 가이드
- Node.js
- 그래프
- BFS
- 레벨 1
- Algorithm
- 크롤링
- ip
- 프로그래머스
- 타입스크립트
- TCP
- 타입 챌린지
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 |