You are given an array a consisting of n integers. In one move, you can jump from your current index i to some index j if,
You will start from index 1 and your task is to reach index n maximizing the sum of the path.
Sum of the path:
Let the indices that you go through while going from index 1 to index n are 1,i2,i3,...,n. So, sum of the path here is equal to a[1]+a[i2]+a[i3]+...+a[n].
Input Format:
Output Format:
For each test case, output in a seperate line:
Maximum sum of path if you start from index 1 and stop at index n.
Constraints:
To get the maximum path sum, we can go through the following indices in this order: 1→2→4→5
The path is valid as difference between every consecutive jumps is a perfect power of 2.