← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Given the root of a binary tree with unique node values and two nodes p and q that exist in the tree, return the lowest common ancestor (LCA) of p and q. The LCA is defined as the deepest node that has both p and q as descendants (a node can be a descendant of itself).