반응형 leetcode2 #32 [파이썬] LeetCode: Number of Provinces https://leetcode.com/problems/number-of-provinces/submissions/ Number of Provinces - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 코드 from typing import List class Solution: def dfs(self, i: int, isConnected: List[List[int]]): isConnected[i][i] = 0 for j in range(len(isConnected).. 2022. 2. 12. #31 [파이썬] LeetCode: Number of Islands https://leetcode.com/problems/number-of-islands/ Number of Islands - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 코드 class Solution: def dfs(self, grid: List[List[str]], i: int, j: int): if i = len(grid) or j = len(grid[0]) or grid[i][j] == '0': return grid[i.. 2022. 2. 12. 이전 1 다음 728x90 반응형