Bhavi runs the apothecary at the lantern reef of Glowtide. Today the books show a list of stairwells, and the numbers must be worked out before sundown. Task: Choose a subset of the n values so no two chosen values are adjacent; print the maximum achievable sum. Input format: First line: n. Second line: n nonnegative integers. Output format: Print the maximum sum. Constraints: 1 <= n <= 4000; 0 <= a[i] <= 1000000000.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 4000; 0 <= a[i] <= 1000000000.
