Algorithm/프로그래머스
[프로그래머스] Lv.2 H-Index
츄르릅
2022. 9. 26. 20:49
https://school.programmers.co.kr/learn/courses/30/lessons/42747
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
1. 해결방법
https://en.wikipedia.org/wiki/H-index
h-index - Wikipedia
From Wikipedia, the free encyclopedia Jump to navigation Jump to search Metric that attempts to measure the productivity and citation impact of a person's publications The h-index is an author-level metric that measures both the productivity and citation i
en.wikipedia.org
주어진 리스트를 역정렬 한 다음, 인덱스의 위치와 그 값을 비교하면더 H-index를 구한다.
2. 정답코드
def solution(citations):
answer = 0
c_list = sorted(citations, reverse=True)
for i in range(len(c_list)):
if (i + 1) <= c_list[i]:
answer = (i + 1)
else:
return answer
return answer