Notice
Recent Posts
Recent Comments
Link
250x250
반응형
DecordRay
[프로그래머스] Level2 : H-Index[Python] 본문
728x90
반응형
문제 : https://school.programmers.co.kr/learn/courses/30/lessons/42747
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이 :
1. 배열 오름차순 정렬
2. 논문별 인용 횟수는 0회 이상 10000회 이하이므로 10000번 반목문을 돌려서(첫번째 반복문) H-Index의 최댓값을 탐색
3. 인용된 논문이 i 편 이상일 경우 H-Index값 최신화(두번째 반복문)
코드 :
def solution(citations):
answer = 0
citations.sort()
for i in range(10001):
for j in range(len(citations)):
if citations[j] >= i:
if len(citations[j:]) >= i:
answer = i
return answer
728x90
반응형
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] Level2 : 행렬의 곱셈[Python] (0) | 2023.01.06 |
---|---|
[프로그래머스] Level2 : [1차] 캐시[Python] (0) | 2023.01.06 |
[프로그래머스] Level2 : 멀리 뛰기[Python] (0) | 2023.01.05 |
[프로그래머스] Level2 : 예상 대진표[Python] (0) | 2023.01.04 |
[프로그래머스] Level2 : 점프와 순간 이동[Python] (0) | 2023.01.04 |
Comments