Binary Tree - Lowest Common

please provide me code for Method 1 in this video…sir just described only for method 2
method 1 is through path