problem
solution
option 1 - backtracking
- inorder traverse version
1 | class Solution { |
- postorder traverse version
1 | class Solution { |
option 2 - bfs
1 | class Solution { |
analysis
- time complexity
O(n)
- space complexity
O(n)
1 | class Solution { |
1 | class Solution { |
1 | class Solution { |
O(n)
O(n)