Easy Java Solution
Minimum Hours of Training to Win a Competition\n\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[
# Minimum Hours of Training to Win a Competition\n```\nclass Solution {\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        //Variable to store ans\n        int ans=0;\n        int energysum=0;\n        //Variable to store the total energy require\n        for(int num:energy){\n            energysum+=num;\n        }\n        //If initialEnergy is less than totalEnergy require so adding the difference among the two energy + 1 to initalEnergy\n        if(initialEnergy<(energysum+1)){\n            ans+=energysum-initialEnergy+1;\n            initialEnergy=energysum+1;\n        }\n        int i=0;\n        //Variable add keeps track of the experience require to be added to initialExperience\n        int add=0;\n        while(i<experience.length){\n            //If initialExperience is less then the require experience than computing the differnce among the two experiences + 1, and storing the max of this computed value and value in variable add in add\n            if(initialExperience<=experience[i]){\n                add=Math.max(add,experience[i]-initialExperience+1);\n            }\n            //Decreasing energy\n            initialEnergy-=energy[i];\n            //Adding experience\n            initialExperience+=experience[i];\n            ++i;\n        }\n        //Adding the required experience to be added to ans variable\n        ans+=add;\n        return ans;\n    }\n}\n```
['Math', 'Greedy', 'Java']