Wrong answer in test case

Hey! I ran my code after unlocking the test cases provided, worked fine but still not passing the test cases. Help! Check my code please

hello @vaani787

u are not ensuring that at evry instant the health must >=k . all u r checking is final health which is wrong . if at any instant it went less than k then immediately stop executin of loop and print loop.

u can take help of boolean variable to indicate whether health ever reach

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.