2368. Reachable Nodes With Restrictions 2368. Reachable Nodes With Restrictions class Solution: def reachableNodes(self,
841. Keys and Rooms 841. Keys and Rooms 透過拿到的鑰匙來造訪後面的房間,是圖形搜索的一種問題。 class Solution: def canVisitAllRooms(
1466. Reorder Routes to Make All Paths Lead to the City Zero 1466. Reorder Routes to Make All Paths Lead to the
1584. Min Cost to Connect All Points 這一題如果不用 UnionFind 的確會有點難做。 class UnionFind: def __init__(self, size): self.
399. Evaluate Division 399. Evaluate Division class Solution: def calcEquation(self, equations: List[
1202. Smallest String With Swaps 1202. Smallest String With Swaps 這個題目難在要怎麼想到使用 Graph 的實作來做。 題目給定的 pairs