Java dp solution
\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int ene = energy[energy
```\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int ene = energy[energy.length - 1] + 1;\n        int exp = experience[energy.length - 1] + 1;\n        for (int i = energy.length - 2; i >= 0; i--) {\n            ene = ene + energy[i];\n            exp = Math.max(exp - experience[i], experience[i] + 1);\n        }\n        return Math.max(ene - initialEnergy, 0) + Math.max(exp - initialExperience, 0);\n    }\n}\n```
[]