270. Closest Binary Search Tree Value

  • recursive: pass pre node value when null
  • iterative: similar dfs

272. Closest Binary Search Tree Value II

  • inorder traverse all nodes and get k nearest

285. Inorder Successor in BST

  • read carefully

298. Binary Tree Longest Consecutive Sequence

  • dfs: pass parent value to children and compare values

333. Largest BST Subtree

  • construct a class to hold size, lower bound, upper bound
  • go in bottom-up
  • deal with leaves carefully, better use infinit