LeetCode

870. Advantage Shuffle

870. Advantage Shuffle class Solution: def advantageCount(self, nums1: List[

74. Search a 2D Matrix

74. Search a 2D Matrix class Solution: def searchMatrix(self,

410. Split Array Largest Sum

410. Split Array Largest Sum 原題: 1011. Capacity To Ship

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 這個題目的主要考察點是要如何先確定邊界,