프로그래머스 정렬 Level 2. H-Index 파이썬 bisect 풀이

minan·2021년 6월 21일
0

프로그래머스

목록 보기
13/92

프로그래머스 정렬 Level 2. H-Index 파이썬 bisect 풀이
문제링크 https://programmers.co.kr/learn/courses/30/lessons/42747

저장용

이건 내가 봐도 허접한 풀이니까 다른 풀이 보시길
그래서 주석도 안넣어놓음

import bisect

def solution(citations):
    answer = 0
    
    citations.sort()
 
    for h in range(maximum):
        left = bisect.bisect_left(citations, h)
        
        if h <= (len(citations)-left) and left <= h:
            answer = max(h, answer)
    
    return answer
profile
https://github.com/minhaaan

0개의 댓글