as per the code ,
inside the loop , we are checking
but there is a chance that earlier s<k but at the end of both loop, there may be the chance that s would be greater than k
then how could we print “No” by breaking the loop???
If he won’t have enough strength to traverse one more step, then he can’t walk. Although what you are thinking is right that at the end of the loop it’s possible that he can attain strength so that we can print yes. But in this problem its not asked. What asked is if it any point s<k, you will come out of the loop and print No.
If this solves your doubt, mark it as resolved