✅✅✅ [JAVA] THIS PROBLEM IS ACTUALLY VERY EASY!! ✔
Runtime: 0 ms, faster than 100.00% of Java online submissions for Minimum Hours of Training to Win a Competition.\nMemory Usage: 41.9 MB, less than 57.14% of Ja
**Runtime: 0 ms, faster than 100.00% of Java online submissions for Minimum Hours of Training to Win a Competition.\nMemory Usage: 41.9 MB, less than 57.14% of Java online submissions for Minimum Hours of Training to Win a Competition.**\n\nJava code:\n```\n    public int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int training = 0;  // keep track of how many hours needed to train\n        int energyNum = initialEnergy;\n        int experienceNum = initialExperience;\n        for(int i = 0; i<energy.length; i++) { // loop through all the opponents\n            if (energyNum <= energy[i]) {                // if you don\'t have enough energy\n                training += (energy[i] + 1) - energyNum; // , then spend the min amount of hours needed to get enough energy\n                energyNum= energy[i] + 1;                //  to beat the opponent\n            }\n            if(experienceNum <= experience[i]) {                 // if you don\'t have enough experience\n                training += (experience[i] + 1) - experienceNum; // , then spend the min amount of hours needed to get enough\n                experienceNum = experience[i] + 1;               // experience to beat the opponent\n            }\n            energyNum -= energy[i]; // after beating the opponent, your energy decreases\n            experienceNum += experience[i]; // after beating the opponent, your experience increases\n        }\n        return training;\n    }\n```
['Array', 'Java']