Java || Hand Written Explaination || Easy to  Understand
\n\n\t\t\nint n=energy.length;\n        int ene=initialEnergy;\n        int exp=initialExperience;\n        int c=0,i=0;\n        while(i<n){\n            if(ex
![image](https://assets.leetcode.com/users/images/491f7c03-2a26-4362-9757-26600e21b398_1661612155.9461555.jpeg)\n```\n\t\t\nint n=energy.length;\n        int ene=initialEnergy;\n        int exp=initialExperience;\n        int c=0,i=0;\n        while(i<n){\n            if(exp>experience[i] && ene>energy[i]){\n                exp=exp+experience[i];\n                ene=ene-energy[i];\n                i++;\n            }\n            else{\n                if(exp<=experience[i]){\n                    c++;\n                    exp++;\n                }\n                if(ene<=energy[i]){\n                    c++;\n                    ene++;\n                }\n            }\n        }\n        return c;\n\n```
['Java']