LeetCode

1584. Min Cost to Connect All Points

這一題如果不用 UnionFind 的確會有點難做。 class UnionFind: def __init__(self, size): self.

UnionFind

Quick Find class UnionFind: def __init__(self, size): self.root

276. Paint Fence

276. Paint Fence class Solution: def numWays(self, n: int,

1091. Shortest Path in Binary Matrix

1091. Shortest Path in Binary Matrix 可以先練習這些題目 * 200. Number of

787. Cheapest Flights Within K Stops

787. Cheapest Flights Within K Stops 這一題的考點 1. 在 BFS

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

1101. The Earliest Moment When Everyone Become Friends

1101. The Earliest Moment When Everyone Become Friends 這個題目是我認為很好的一道面試題,因為題目的情景很貼近日常生活,

797. All Paths From Source to Target

797. All Paths From Source to Target class Solution: def

1335. Minimum Difficulty of a Job Schedule

1335. Minimum Difficulty of a Job Schedule 這個題目其實寫的滿不清楚的,面試如果遇到這個題目其實也考察如何向面試官搞清楚題目的流程的。 這個題目是給定一個陣列,