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 |
Tags
- c++
- the longest increasing subsequence
- boj 11657
- lock free stack
- ice cream parlor
- pccp 기출문제 풀이
- 2025 프로그래머스 코딩챌린지 1차예선
- pcce 기출문제 풀이
- count triplets
- find the town judge
- lock based queue
- LCS
- two characters
- PCCE
- dp
- boj 1717
- find the running median
- boj 6443
- boj 1074
- making anagrams
- the maximum subarray
- gas
- DirectX12
- 프로그래밍공부
- DirectX
- lock based stack
- 지게차와 크레인
- 브루트포스
- string construction
- special string again
Archives
- Today
- Total
오구의코딩모험
[Python] H-Index 본문
반응형
[코딩테스트 고득점 KIT - 정렬]
논문 인용 수를 역순으로 정렬하여 내림차순으로 탐색한다.
논문의 수인 l 보다 인용 수가 이상인 경우를 filter로 걸러낸 후,
리스트의 길이를 H에 담는다.
H의 길이가 l 이상이고, H 이외의 인용 수가 l 이하라면
l이 곧 H-Index!
끝
def solution(citations):
answer = 0
citations = sorted(citations,reverse=True)
for l in range(len(citations),0,-1):
H = len(list(filter(lambda x : x>= l,citations)))
if H >= l and len(citations)-H <= l:
answer = l
break
return answer
반응형
'프로그래밍 공부 > 프로그래머스' 카테고리의 다른 글
[Python] 피로도 (0) | 2023.01.03 |
---|---|
[Python] 카펫 (0) | 2023.01.02 |
[Python] K번째수 (1) | 2023.01.01 |
[Python] 디스크 컨트롤러 (0) | 2022.12.31 |
[Python] 더 맵게 (0) | 2022.12.30 |
Comments