Company: hirepro_sde_intern_offcampus
Difficulty: medium
Consider a binary tree of N nodes (1 Root and N-1 descendants). Each node, X is related to Root by some relations such as L, R, LL, LR... and so on, where X is left (L) to Root or left-left (LL) or right-left (RL) to Root and so on. 2 nodes A and B are given as query. Write a program to print the Lowest Common Ancestor (LCA) of A and B. Lowest Common Ancestor (LCA): LCA of 2 nodes is defined as the lowest (i.e. deepest) node that has both A and B as descendants, where we define each node to be a descendant of itself (so if A has a direct connection from B, B is the lowest common ancestor). Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the standard output and testcases will fail. Constraints: 3 <= N <= 100 All nodes in the tree are unique Input Format: The first line of input contains an integer, N, number of nodes in the tree. The second line of input contains an integer,