3259. Maximum Energy Boost From Two Drinks
You are given two integer arrays
energyDrinkAandenergyDrinkBof the same lengthnby a futuristic sports scientist. These arrays represent the energy boosts per hour provided by two different energy drinks, A and B, respectively.You want to maximize your total energy boost by drinking one energy drink per hour. However, if you want to switch from consuming one energy drink to the other, you need to wait for one hour to cleanse your system (meaning you won’t get any energy boost in that hour).
Return the maximum total energy boost you can gain in the next
nhours.Note that you can start consuming either of the two energy drinks.
1 | class Solution { |