Java Solution
\n\n\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        \n        \n       
\n\n```\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        \n        \n        int hrs=0;\n\n         int sumEne=0;\n\n         for(int x:energy){\n             sumEne+=x;\n         }\n\n     \n        if(sumEne>=initialEnergy) {\n            hrs = sumEne - initialEnergy + 1;\n        }\n\n\n        int tempHrs=0;\n\t\t\n         for(int i=0;i<experience.length;i++){\n\n             if(initialExperience<=experience[i]){\n\n                 tempHrs+=experience[i]-initialExperience+1;\n                 initialExperience+=experience[i]+tempHrs;\n             }else{\n                 initialExperience+=experience[i];\n             }\n         }\n        \n        return hrs+tempHrs;\n    }\n}\n\n```
[]