Company: Mtx_12nov
Difficulty: medium
Sum of Last Numbers from Completely Filled Levels Description You are given an array arr of n integers. Insert the values into a binary tree in level order: arr[0] becomes the root, the next two values become level 2 from left to right, the next four become level 3 from left to right, and so on. Every level is filled left to right before the next level is started, so the resulting tree is almost complete : only the deepest level may be short of nodes. A level is completely filled when it holds its full capacity, which is 1 node on level 1, 2 on level 2, 4 on level 3 and 2^(k-1) on level k . Report the sum of the last (rightmost) value of every completely filled level . Complete the function getLastNumbers in the editor below. Function Signature long long getLastNumbers(vector<int> arr, int n); Input The input is read from standard input as whitespace-separated integers, in this order: n , the number of values. n integers, the array arr . When n is 0 the array is empty and nothing