Doubt in my code

Hello, what’s wrong in my code because I am getting wrong answer My answer should be 3 but it is giving me 6 Why?

Correction in line 8
if(stalls[i]-prev_cow >= min_sep){

only prev_cow
not stall[prev_cow]

1 Like

Ok thank you :slightly_smiling_face:

1 Like

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.