반응형

전체 카테고리 218

2101. Detonate the Maximum Bombs

https://leetcode.com/problems/detonate-the-maximum-bombs/ adjacent를 표현하는 그래프를 먼저 그리고 그에 맞도록 DFS를 해주면 된다. 그리고 한 칸 이동 = stack pop 할 때마다 카운터 +1 하면 된다. class Solution: def maximumDetonation(self, bombs: List[List[int]]) -> int: n = len(bombs) adj = [[] for _ in range(n)] # Make Graph: i can bomb out j? for i in range(n): xi, yi, ri = bombs[i] r..

반응형