LeetCode

86. Partition List

86. Partition List 這個題目的關鍵在於要理解當指向另一個節點時,會一併把該節點指向的後續節點都放進當前的 Linked List ,我們需要斷開該節點與後續所有節點的連結,並能繼續往前走。 # Definition

1658. Minimum Operations to Reduce X to Zero

1658. Minimum Operations to Reduce X to Zero 給定一個數組 nums

298. Binary Tree Longest Consecutive Sequence

298. Binary Tree Longest Consecutive Sequence 參考:257. Binary Tree

129. Sum Root to Leaf Numbers

129. Sum Root to Leaf Numbers 請參考 257. Binary Tree

257. Binary Tree Paths

257. Binary Tree Paths 題目給定一個二元樹,要找出從跟節點到最終的葉節點的所有路徑。 既然這個題目要求要找出所有可能的路徑,那就一定是需要窮舉的題目,既然需要窮舉,就可以用

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