LeetCode

21. Merge Two Sorted Lists

21. Merge Two Sorted Lists # Definition for singly-linked list. # class

702. Search in a Sorted Array of Unknown Size

702. Search in a Sorted Array of Unknown Size 這個題目的主要考察點是要如何先確定邊界,

658. Find K Closest Elements

658. Find K Closest Elements 這個題目是給定一個點 x,要找出最接近的 k 個點,

206. Reverse Linked List

206. Reverse Linked List 在當前的節點中,我們要把原先指向下一個節點的方向,轉變為指向上一個節點(已經反轉完成的節點),接著處理下一個節點。 1.

199. Binary Tree Right Side View

199. Binary Tree Right Side View 這一題和 116. Populating Next

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