70points in HOSPBEDS

Can any one let me know whats wrong
https://www.codechef.com/viewsolution/32457828

Try swapping the conditions.

Check (j+1) < n first, and then arr[i][j+1]

I have tried both but it didnt make any difference