Gary Lai

724. Find Pivot Index

724. Find Pivot Index 這一題的目標是我們要找到在陣列中的一個索引,這個索引左側的所有數字的總和相等於右側的所有數字總和,索引的位置可能在這個陣列中的任何一個地方,取決於左側和右側每個數字的大小以及其分佈。 這一題比較直觀的想法是,那我先計算出這個陣列從左到右的累加總和,

409. Longest Palindrome

409. Longest Palindrome from collections import Counter class Solution: def

210. Course Schedule II

210. Course Schedule II Check 207. Course Schedule

207. Course Schedule

207. Course Schedule 這一個題目的設計滿巧秒的,我個人覺得這個題目綜合了樹的遍歷(遞迴)、回溯法、動態規劃以及資料與圖形轉換的設計,外加上題目可以套用在各種現實生活問題中。所以整體而言

1676. Lowest Common Ancestor of a Binary Tree IV

1676. Lowest Common Ancestor of a Binary Tree IV Check

1650. Lowest Common Ancestor of a Binary Tree III

1650. Lowest Common Ancestor of a Binary Tree III Check

1644. Lowest Common Ancestor of a Binary Tree II

1644. Lowest Common Ancestor of a Binary Tree II Check

236. Lowest Common Ancestor of a Binary Tree

236. Lowest Common Ancestor of a Binary Tree Check 235.

235. Lowest Common Ancestor of a Binary Search Tree

* 235. Lowest Common Ancestor of a Binary Search Tree * 236.

18. 4 Sum

18. 4 Sum Check 15. 3 Sum