Company: Flipkart_3sep
Difficulty: medium
Sum of Root-to-Leaf Path Numbers Problem Description Consider a binary tree with N nodes (1 Root and N-1 descendants). Each node, X is related to the 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. Perform the following operations to find the value of Sum. If the given tree has M leaf nodes, there will be M minimum paths from root to M leaf nodes. Each path, Path i is the path from root to the i th leaf node, where 1 ≤ i ≤ M. Find all such paths. Concatenate all node values along the Path i to form an integer P i , where 1 ≤ i ≤ M. Calculate Sum, where Sum = P 1 + P 2 + ... + P M . Write a program to print Sum. 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. Input Format The first line of input contains an integer, N, the number of nodes in the tree. The s