Java | Iterative | Straightforward Solution
\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int ene = initialEnergy
```\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int ene = initialEnergy;\n        int exp = initialExperience;\n        int res=0,diff=0;\n        for (int i=0;i<energy.length;i++) {\n            if (energy[i]>=ene) {   \n                diff = energy[i]-ene+1;\n                res = res+diff;\n                ene = ene+diff;\n            }\n            ene = ene-energy[i];\n            if (experience[i]>=exp) {\n                diff = experience[i]-exp+1;\n                res = res+diff;\n                exp = exp+diff;\n            }\n            exp = exp+experience[i];\n        }\n        return res;\n    }\n}\n```\nKindly upvote if you like the code.
['Iterator', 'Java']