Easy Understanding || O(n) || C++
\n int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience) {\n        int n= energy.size();\n        int en
```\n int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience) {\n        int n= energy.size();\n        int energy_sum=1;\n        int curr_exp=initialExperience;\n\t\t\n\t\t// let training hours needed in maintaining experience and initiate as 0\n        int training_hours=0;\n        for (int i=0; i<n; i++)\n        {\n            energy_sum+=energy[i];\n            \n\t\t\t// if current experience is greater than experience needed to kill ith task\n            if (curr_exp>experience[i])\n            {\n               curr_exp+=experience[i];\n            }\n            else {\n\t\t\t// training hours to increase experience to complete ith task\n                training_hours+=experience[i]+1-curr_exp;\n                curr_exp= experience[i]+1+ experience[i];\n               \n            }\n            \n        }\n        int s=energy_sum-initialEnergy;\n\t\t\n\t\t//if energy sum is lesser than initial energy\n        if(s<=0)\n        {\n            s=0;\n        }\n        return s+training_hours;\n    }\n};\n```
['C++']