94: Binary tree longest consecutive sequence

Given a binary tree, return the length on the longest consecutive sequence path. A path can start from any node and go from top to bottom

 

Example 1

Input:     1   
          / \  
         3   2 

Output:  2

Explanation: 1 and 2

Example 2

Input:     1   
            \  
             3 

Output: 1

Explanation: 1 or 3

Difficulty:Medium
Topic:Tree
Problem #:94