What is going wrong with my code

https://hack.codingblocks.com/app/practice/1/1051/problem

can someone explain what is going wrong with my code that i m only passing partial testcase

the problem name is piyush and magical park’

1 Like

image

u need to add this condition whenever u switch to the next row
u need to check is the strength has reduced below k
if yes print"No" else continue to next line

1 Like

updated code

1 Like

but why is that important i m checking the whole array and at the end i m saying that if s>=k;
then say “yes” and print the value ,otherwise print No;; that should also work fine, no?
@chhavibansal :sleeping:

nope
agar power he kum hogi to traverse nhi kar sakte

1 Like

ohh yes got it ,thanks!
Also one question that the return we used ,will it get us out of the inner loop or the whole function?
@chhavibansal ?

from the whole function

1 Like

Thankyousomuch :slight_smile:

1 Like