위클리 챌린지

    [python] 프로그래머스 - 피로도(위클리챌린지)

    [python] 프로그래머스 - 피로도(위클리챌린지)

    🤔문제 해결 💫 던전의 길이가 최대 8개 이므로 permutation으로 탐험하는 순서의 모든 경우의 수를 구했다. 💫 탐험 순서대로 던전을 탐험하며 피로도 조건에 맞는 동굴만 탐험하며 갯수를 세어준다. 💫 각각의 사이클마다 탐험가능한 동굴의 갯수를 최대값으로 업데이트 해준다. 💻소스 코드 from itertools import permutations def solution(k, dungeons): answer = -1 for perm in (permutations(dungeons, len(dungeons))): cur_k = k expol_cnt = 0 for dungeon in perm: if cur_k >= dungeon[0]: expol_cnt += 1 cur_k -= dungeon[1] answ..