Calculate energy and exp hours seperately
\n\nclass Solution {\npublic:\n    int minNumberOfHours(int iEn, int iEx, vector<int>& en, vector<int>& ex) {\n        for(int i=1;i<en.size();i++){\n          
\n```\nclass Solution {\npublic:\n    int minNumberOfHours(int iEn, int iEx, vector<int>& en, vector<int>& ex) {\n        for(int i=1;i<en.size();i++){\n            en[i] += en[i-1];\n        }\n        int EnHours = en[en.size()-1] - iEn+1;\n        EnHours = (EnHours<0)?0:EnHours;\n        int ExHours=0;\n        for(int i=0;i<ex.size();){\n            if(iEx > ex[i]){\n                iEx += ex[i];\n                i++;\n            }else{\n                ExHours += ex[i]-iEx+1;\n                iEx = ex[i]+1;\n            }\n        }\n        cout<<EnHours<<" "<<ExHours<<" ";\n        return EnHours + ExHours;\n    }\n};\n```
['C++']