LeetCode

841. Keys and Rooms

841. Keys and Rooms 透過拿到的鑰匙來造訪後面的房間,是圖形搜索的一種問題。 class Solution: def canVisitAllRooms(

190. Reverse Bits

190. Reverse Bits class Solution: def reverseBits(self, n: int)

405. Convert a Number to Hexadecimal

405. Convert a Number to Hexadecimal 💡這個題目有一個知識點需要先複習:「二補數」 class Solution:

504. Base 7

504. Base 7 class Solution: def convertToBase7(self, num: int)

2095. Delete the Middle Node of a Linked List

2095. Delete the Middle Node of a Linked List # Definition

747. Largest Number At Least Twice of Others

747.Largest Number At Least Twice of Others 這一題是一個簡單的題目,解題的主要邏輯:

1466. Reorder Routes to Make All Paths Lead to the City Zero

1466. Reorder Routes to Make All Paths Lead to the

643. Maximum Average Subarray I

643. Maximum Average Subarray I 題目不難,但是小細節很多,這個題目主要的考點是滑動窗口。 最一開始的想法是每次移動一個 index

1456. Maximum Number of Vowels in a Substring of Given Length

1456. Maximum Number of Vowels in a Substring of Given

933. Number of Recent Calls

933. Number of Recent Calls 這個題目可以利用 min heap 可以保持排序的方式來檢查,只要