Hi sir/mam,
why my source code not pass the two test cases?
my source code_https://ide.codingblocks.com/s/266163
one more doubt=>
when i use s-1 in last if condition it give wrong answer s=7 as answer and when i use s–; it give corect answer s=17,why?
Two test cases is not pass
correct answer is 13 according to the sample output. Please do a dry run on the sample input once to figure out the logical errors, if you need any help let me know
yes it is s=13,but please tell why it is so ? why my code wrong answer?
@Nikhil-Jettley-2567269533523013 like I said try dry running it yourself one time, it is a simple iterative code so it will be good for practice, I’d be happy to help if you are stuck with the dry run
mam,please reply! as i wait for it from long
@Nikhil-Jettley-2567269533523013 the whole problem is arising because you are taking input in the same loop as you are analyzying the maze, so when you skip to the next line after encountering ‘#’ you end up not taking input for the rest of the columns, and they end up being assigned to the next rows.
So in short, you end up taking wrong input and hence giving wrong output also. Make a separate loop for input and a separate loop for other stuff.
Modified code:
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.