[프로그래머스] H-Index
H-Index | Lv.2https://school.programmers.co.kr/learn/courses/30/lessons/42747 작성 코드 def solution(citations): citations.sort() # h편 이상 인용되는 것을 세야하니 max 값은 citations의 길이를 넘을 수 없음 for i in range(len(citations), 1, -1): if i [3, 0, 6, 1, 5] -> [0, 1, 3, 5, 6] ilen(citations) - i 5번 이상 인용50citation[0] 부터는 i 보다 크거나 같아야 함4번 이상 인용41citation[1] 부터는 i 보다 크거나 같아야 함3번 이상 인용32citation..
2023. 5. 18.
[프로그래머스] 디스크 컨트롤러
https://school.programmers.co.kr/learn/courses/30/lessons/42627?language=ruby 작성 코드 (실패) from collections import deque def solution(jobs): visit = deque(jobs) def dfs(total_time, visited, depth, wait_time, min_wait_time): print(1, total_time, visited, depth, min_wait_time) if depth == len(jobs): min_wait_time = min(min_wait_time, total_time) return min_wait_time for idx1, v in enumerate(visited)..
2023. 5. 17.