✅C++ || ✅Simple || ✅Easy to Understand
\nclass Solution {\npublic:\n    int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience)\n    {\n        in
```\nclass Solution {\npublic:\n    int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience)\n    {\n        int op=0;\n        int n = energy.size();\n        int diff=0;\n        for(int i=0;i<n;i++)\n        {\n            if(initialEnergy<=energy[i])\n            {\n                diff = (energy[i]-initialEnergy+1);\n                initialEnergy += diff;\n                op += diff;\n            }\n            if(initialExperience<=experience[i])\n            {\n                diff = (experience[i]-initialExperience+1);\n                initialExperience += diff;\n                op += diff;\n            }\n            \n            initialEnergy -= energy[i];\n            initialExperience += experience[i];\n        }\n \n        return op;\n    }\n};\n```
[]