132. Lowest Common Ancestor of a Binary Tree

Given a binary tree and two values p and q (the nodes exist in the tree), return the value of the lowest common ancestor of nodes p and q.
Example 1
Input: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4
Output: 5
Explanation: The LCA of nodes 5 and 4 is node 5.
Example 2
Input: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
Output: 3
Explanation: The LCA of nodes 5 and 1 is root 3.
binary treemediumrecursiontree
JavaScript
Line 1, Char 1