Gary Lai

244. Shortest Word Distance II

244. Shortest Word Distance II 參考: 243. Shortest Word Distance

2244. Minimum Rounds to Complete All Tasks

2244. Minimum Rounds to Complete All Tasks 這一題可以算是經典的 Dynamic Programming

243. Shortest Word Distance

243. Shortest Word Distance 這是一個非常適合面試的題目,暴力法求解的方式也很簡單如下: class Solution: def shortestDistance(

1166. Design File System

1166. Design File System 這個題目滿好想到使用 Trie 的方式來實作的,不過邏輯上要注意幾點 1. 要如何確保

1926. Nearest Exit from Entrance in Maze

1926. Nearest Exit from Entrance in Maze 這個問題屬於 BFS 的問題

1751. Maximum Number of Events That Can Be Attended II

1751. Maximum Number of Events That Can Be Attended II

1992. Find All Groups of Farmland

1992. Find All Groups of Farmland class Solution: def findFarmland(

829. Consecutive Numbers Sum

829. Consecutive Numbers Sum 這個題目我覺得不用太糾結於最佳解,這個偏向數學題目,但是我覺的是很好的面試題目 首先第一的絕對是不能先去想要怎麼拆解數字,我是先停下來觀察了一下什麼是連續正整數相加。像是:

2300. Successful Pairs of Spells and Potions

2300. Successful Pairs of Spells and Potions class Solution: def

931. Minimum Falling Path Sum

931. Minimum Falling Path Sum class Solution: def minFallingPathSum(self,