C++ | Easy Code
Please Upvote :)\n\n\nclass Solution {\npublic:\n    int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience
Please Upvote :)\n\n```\nclass Solution {\npublic:\n    int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience) {\n        int p=0,q=0;\n        int curr=initialExperience;\n        for(auto x:energy)\n            p+=x;\n        for(int i=0;i<experience.size();i++)\n        {\n            if(curr<=experience[i])\n            {\n                q+=experience[i]-curr+1;\n                curr=experience[i]+1;\n            }\n            curr+=experience[i];\n        }\n        if(p>=initialEnergy)\n            p=p-initialEnergy+1;\n        else\n            p=0;\n        \n        int res=0;\n        if(p>0)\n            res+=p;\n        if(q>0)\n            res+=q;\n        return res;\n    }\n};\n```
['C']