Leetcode 풀기 | 200. Number of Islands / 2. Add Two Numbers / 269. Alien Dictionary


Leetcode 풀기 | 200. Number of Islands / 2. Add Two Numbers / 269. Alien Dictionary

200. Number of Islands 출제 회사: Amazon 312, Bloomberg 34, Facebook 19.. 개념: DFS, BFS, Union find https://leetcode.com/problems/number-of-islands/ 이 문제도 이미 두 번이나 풀고 DFS를 생각하긴 했는데 중간에 조금 꼬였었다. 그래도 DFS 로 푼 최종 답: class Solution: def numIslands(self, grid: List[List[str]]) -> int: # corner case: when grid is [] if not grid: return 0 rLength = len(grid) # length of row cLength = len(grid[0]) # length of col totalcount = 0 for r in range(rLength): for c in range(cLength) : if grid[r][c] == "1": self.chec...


#Leetcode #릿코드문제풀이 #코딩인터뷰준비

원문링크 : Leetcode 풀기 | 200. Number of Islands / 2. Add Two Numbers / 269. Alien Dictionary