Find Peak Element (LeetCode 162, Binary Search)
thoughts
峰值定義:nums[i] > nums...
Lowest Common Ancestor of a Binary Search Tree
thoughts
BST 性質:左子樹 < root &l...
Middle of the Linked List (Linked List) 876
question
給定一個單向鏈結串列,找到其中間節點並回傳。
如果有...
543 Diameter of Binary Tree
thoughts
樹的直徑:任意兩個節點之間的最長路徑(經過 root 或不經 root)。
DFS...
110 Balanced Binary Tree
thoughts
平衡樹定義:每個節點的左右子樹高度差 ≤ 1
遞迴計算高度:若某個子樹不平衡,回傳 -1...
透過測試降低錯誤, TDD 真正足讚
1. Runtime Errors
Undefined property access: 這部份家己應該先定好 API...