Choose at most one drink per hour from two energy-drink sequences, without taking from the same drink in consecutive hours, to maximize total energy boost.
You are given two arrays of integers, drink1 and drink2, each representing the energy boost you gain from drinking one bottle at each hour.
You may choose at most one drink in each hour, and if you drink at hour i, then on hour i + 1 you may not choose the same drink again.
Your task is to compute the maximum total energy boost you can obtain.
In other words:
drink1 at hour i, then at hour i+1 you cannot choose drink1 again.drink2 at hour i, then at hour i+1 you cannot choose drink2 again.drink1 and drink2drink1.length == drink2.length == ndrink1[i] and drink2[i] are the boosts available at hour i from each drink1 <= n <= $10^{5}$$-10^{9}$ <= drink1[i], drink2[i] <= $10^{9}$Example 1
Input
drink1 = [4, 2, 7] drink2 = [1, 5, 3]
Output
12
Explanation
One optimal plan is:
Total = 4 + 5 + 7 = 16.
If the intended interpretation is that you can take only one drink total per hour and cannot take both, this sequence is valid because the chosen drink alternates each hour.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.