2383. Minimum Hours of Training to Win a Competition
On This Page
class Solution:
def minNumberOfHours(
self,
initialEnergy: int,
initialExperience: int,
energy: List[int],
experience: List[int],
) -> int:
res = max(0, sum(energy) - initialEnergy + 1)
for x in experience:
if initialExperience <= x:
res += x - initialExperience + 1
initialExperience = x + 1
initialExperience += x
return res