problem
solution
dfs
1 | class Solution { |
bfs
1 | class Solution { |
analysis
- backtracking
time complexityO(n)
space complexityO(logN)
- bfs
time complexityO(n)
space complexityO(n)
, N/2 樹最底層的節點數量
1 | class Solution { |
1 | class Solution { |
O(n)
O(logN)
O(n)
O(n)
, N/2 樹最底層的節點數量