Company: Mtx_12nov
Difficulty: medium
Sum of Last Numbers from Completely Filled Levels Problem Description Consider that you are provided with a list A of N integers. Your task is to construct an almost complete binary tree using the elements of A and write a program to print the sum of all the last numbers from each level that are completely filled. An almost complete binary tree is a binary tree that satisfies the following conditions: - Insertion of nodes must take place level by level and all the nodes must be left justified. - All the levels from 1 to h-1 levels (where h stands for the total number of levels in the tree) should be completely filled without any gaps. The input will be read from STDIN and the output should be printed to STDOUT. Examples Example 1: Tree Construction and Sum Calculation If the elements of the list L are [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10], then the constructed almost complete binary tree would be structured as follows: x1 / \ x2 x3 / \ / \ x4 x5 x6 x7 / \ x8 x9 x10 Explanation: In