목록BFS (9)
취미가 좋다

https://leetcode.com/problems/course-schedule/ Course Schedule - 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 Solution from queue import Queue class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: q = Queue() a2b = {} # a : 조건이 필요한 수업 b2a ..
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 Solution class Solution: def __init__(self): self.m = 0 self.n = 0 self.grid = [] self.visit = [] def numIslands(self, grid): self.m = len(grid) self.n = len(grid[0]..
https://leetcode.com/problems/binary-tree-right-side-view/ Binary Tree Right Side View - 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 Solution # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left ..