✅ C++ solution || Greedy approach || Easy to understand.
\nclass Solution {\npublic:\n    int minNumberOfHours(int iniEne, int iniExp, vector<int>& ene, vector<int>& exp) {\n        int sumEne=0;\n        int ans=0;\n
```\nclass Solution {\npublic:\n    int minNumberOfHours(int iniEne, int iniExp, vector<int>& ene, vector<int>& exp) {\n        int sumEne=0;\n        int ans=0;\n        for(int i=0;i<size(ene);i++)\n        {\n            sumEne+=ene[i];\n        }\n        if(sumEne>=iniEne)\n        {\n            ans+=(sumEne-iniEne)+1;\n        }\n        for(int i=0;i<size(exp);i++)\n        {\n            if(iniExp>exp[i])\n                iniExp+=exp[i];\n            else\n            {\n                ans+=(exp[i]-iniExp)+1;\n                iniExp+=((exp[i]-iniExp)+1)+exp[i];\n            }\n            \n        }\n        return ans;\n    }\n};\n```
['Greedy', 'C', 'C++']