numJars, the number of jars, N.N space-separated integers, where each value is the chocolate count for one jar.1 < N <= 1000.Input:
6
5 30 99 60 5 10
Output:
114
Explanation: selecting jars 1, 3, and 6 gives 5 + 99 + 10 = 114, which is the maximum total.
nums = [5, 30, 99, 60, 5, 10]114
We have 6 jars with chocolate counts. Goal: select non-adjacent jars to maximize total chocolates.
nums = [5, 30, 99, 60, 5, 10]114
We have 6 jars with chocolate counts. Goal: select non-adjacent jars to maximize total chocolates.