We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f81ef13 commit cdc320bCopy full SHA for cdc320b
Hongjoo/lv2/피로도_재시도.py
@@ -0,0 +1,17 @@
1
+def solution(k, dungeons):
2
+ max_count = 0
3
+ def brutefoce(path, life):
4
+ nonlocal max_count
5
+ for idx in range(len(dungeons)):
6
+ # (유망 여부) 조건에 안 맞으면 건너뛰기 : limit 제한 , 중복 탐사 방지
7
+ if dungeons[idx][0] <= life and idx not in path:
8
+ # 3. 탐색할 노드 선택 - 상태 변화
9
+ path.append(idx)
10
+ # 4. 재귀 호출(담 단계) - 자식 노드로 이동
11
+ brutefoce(path ,life -dungeons[idx][1])
12
+ # 5. 선택 취소 - 부모 노드로 복귀
13
+ path.pop()
14
+ max_count = max(max_count , len(path))
15
+ brutefoce([], k )
16
+
17
+ return max_count
0 commit comments