Practice Maximum Energy Boost From Two Drinks
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two integer arrays energyDrinkA and energyDrinkB of the same length n by 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 n hours. Note that you can start consuming either of the two energy drinks.
Source: Maximum Energy Boost From Two Drinks on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
energyDrinkA = [1,3,1], energyDrinkB = [3,1,1]
5
# Example 2
energyDrinkA = [4,1,1], energyDrinkB = [1,1,3]
7
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Energy Boost From Two Drinks.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.