My Blog List

[Leetcode Solution] Maximum Depth of Binary Tree

Analysis

  • Using BFS search each layer of binary tree from the root to leaf and the node with biggest layer number is the depth of tree
  • Directly recursive call the function on both sub tree and return the max result plus one. Found code here

Note

Code


No comments:

Post a Comment

Enter you comment