44: Maximum depth of a binary tree

Given a binary tree. Find a maximum depth of the binary tree

Note: The maximum depth is the number of nodes from the root node to the farthest leaf node

 

Example 1

Input:        1
             / \
            2   3
               / \
              6   7

Output: 3

Explanation: 1 -> 3 -> 7 or 1 -> 3 -> 6

Example 2

Input:     1   
            \  
             3 

Output: 2