75: Diameter of a binary tree

Given a binary tree, return its diameter

Note: diameter of a binary tree is the length of the longest path between any two nodes in the tree

 

Example 1

Input:     1   
          / \  
         5   3 

Output: 2

Example 2

Input:     1   
            \  
             3 

Output: 1
Difficulty:Easy
Topic:Tree
Problem #:75