# LeetCode All Problems Solution Index: Search, Sum and Tree Problems

## Overview

I have summarized the solutions to LeetCode problems by organizing them into closely related categories (Search, Sum and Tree) and give tree index page for quick references.

## LeetCode All Problems Solution Index: Search, Sum and Tree Problems

- Search Problem: usually Binary search, Sorted array
- 1-D: Rotated Array. All these 4 problems are summarized in my post:
- Search in Rotated Sorted Array 2012-03-02 28.5% (Hard) Solution
- Search in Rotated Sorted Array II 2012-04-19 30.4% (Medium) Solution
- Find Minimum in Rotated Sorted Array 2014-10-15 31.7% (Medium) Solution
- Find Minimum in Rotated Sorted Array II 2014-10-20 28.7% (Hard) Solution

- Other Binary Search Problem
- Find Peak Element 2014-12-04 31.7% (Medium) Solution
- Pow(x, n) 2012-03-19 25.9% (Medium) Solution

- 1-D: Rotated Array. All these 4 problems are summarized in my post:
- Sum Problems: All of the following could be solved in a consistent recursive manner!
- 4Sum 2012-01-26 21.3% Solution Furhter on K Sum
- 3Sum Closest 2012-01-18 26.9% Solution
- 3Sum 2012-01-17 16.5% Solution
- Two Sum 2011-03-13 18.2% Solution 1 Solution 2 Solution 3

- Tree Related Problems: try different perspectives including bottom up and top down and other, ususaly, recursive function could give compact solution, the difficulty increases when combining with other tricks like dynamic programming
- Build Binary Search Tree:
- Convert Sorted Array to Binary Search Tree 2012-10-02 32.3% (Medium) Solution
- Convert Sorted List to Binary Search Tree 2012-10-02 27.0% (Medium) Solution
- Construct Binary Tree from Inorder and Postorder Traversal 2012-09-30 26.1% (Medium) Solution
- Construct Binary Tree from Preorder and Inorder Traversal 2012-09-30 26.2% (Medium) Solution

- Tree Traveral: The difficulty for the iterative approach is: Postorder ~>= Inorder >> Preorder
- Binary Tree Preorder Traversal 2013-11-05 35.3% (Medium) Solution
- Binary Tree Inorder Traversal 2012-08-27 35.2% (Medium) Solution
- Binary Tree Postorder Traversal 2013-11-07 30.8% (Hard) Solution 1 Solution 2
- Binary Tree Level Order Traversal II 2012-10-01 30.9% (Easy) Solution
- Binary Tree Zigzag Level Order Traversal 2012-09-28 26.5% (Medium) Solution
- Binary Tree Level Order Traversal 2012-09-28 30.6% (Easy) Solution

- Depth problem: These two could be solved in ONE DFS template consistently, replace the operator max/min, all the other parts of code are the same
- Minimum Depth of Binary Tree 2012-10-09 29.2% Solution
- Maximum Depth of Binary Tree 2012-09-29 43.4% Solution

- DFS Tree: The following two could be solved similarly by DFS
- Same Tree 2012-09-03 41.8% (Easy) Solution
- Symmetric Tree 2012-09-23 31.9% (Easy) Solution

- DFS Tree: Three Path Sum Problems
- Path Sum II 2012-10-14 27.0% (Medium) Solution
- Path Sum 2012-10-13 30.2% (Easy) Solution
- Sum Root to Leaf Numbers 2013-02-18 29.4% (Medium) Solution

- Binary Tree Validation:
- Validate Binary Search Tree 2012-08-31 25.5% (Medium) Solution
- Balanced Binary Tree 2012-10-08 32.3% (Easy) Solution

- Other Tree Problems:
- Binary Tree Maximum Path Sum 2012-11-07 19.7% (Hard) Solution
- Populating Next Right Pointers in Each Node II 2012-10-28 30.0% (Hard) Solution
- Populating Next Right Pointers in Each Node 2012-10-28 35.0% (Medium) Solution
- Unique Binary Search Trees II 2012-08-27 26.7% (Medium) Solution
- Unique Binary Search Trees 2012-08-27 36.0% (Meidum) Solution
- Recover Binary Search Tree 2012-09-01 23.2% (Hard) Solution

- Build Binary Search Tree:

## Summary

I have summarized the solutions to LeetCode problems by organizing them into closely related categories (Search, Sum and Tree) and give tree index page for quick references. I will keep updating the content as well as this index page as time goes. Please feel free to leave any comments.

Written on March 26, 2015