Gary Lai

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 題目給定一個二元樹,要找出從跟節點到最終的葉節點的所有路徑。 既然這個題目要求要找出所有可能的路徑,那就一定是需要窮舉的題目,既然需要窮舉,就可以用

Meta - Kaitenzushi

from typing import List # Write any import statements here import

Meta - Cafeteria

題目問的是餐廳有 N 個位置,但是我們需要保持 k 個單位的社交距離,座位上目前會有 M 個人在位置上,其座位表由

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 個點,