Beats 100%
IntuitionApproachComplexity
Time complexity:
beats 100
Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
beats 100
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minNumberOfHours(self, initialEnergy: int, initialExperience: int, energy: List[int], experience: List[int]) -> int:
        hours = 0
        energyNeeded = sum(energy) + 1
        if energyNeeded >= initialEnergy:
            hours += (energyNeeded - initialEnergy) 

        length = len(energy)
        holder = [initialExperience]
        prefix = initialExperience
        extra = 0

        for i in range(length - 1):
            prefix += experience[i]
            holder.append(prefix)
        for i in range(length):
            if (holder[i] + extra) <= experience[i]:
                print(hours)
                hours += experience[i] - (holder[i] + extra) + 1
                extra += experience[i] - (holder[i] + extra) + 1

        return hours
```
['Python3']