83: Lowest common ancestor of a binary tree

Given a binary tree and two nodes node1 and node2, return lowest common ancestor value

Note: all node values are unique

 

Example 1

Input:        4   node1 = 4, node1 = 5
             / \
            6   5

Output: 4

Example 2

Input:        4   node1 = 5, node1 = 6
             / \
            6   5

Output: 4
Difficulty:Medium
Topic:Tree
Problem #:83