this is my code please help…
i just need to print one path…
it is printing multiple paths which are overlapping with each iteration
this is my code please help…
i just need to print one path…
it is printing multiple paths which are overlapping with each iteration
Hello @manthan.joshi.jiit you have to print the right most path not just one path .
for this read the question properly .
the right most path is the path in which you will always try to move with columns until you find dint find way then only you will move in rows.
and make one separate array of maze size in which you hvae to store the path .
you are doing it in the same array .
i hope i have cleared your doubt .
HAppy learning !!
why cant i do it in the same array ?? i am backtraking it…and not accessing the X …so how can i affect it?
hello @manthan.joshi.jiit have you seen the sample test case
Sample Input
5 4
OXOO
OOOX
OOXO
XOOO
XXOO
Sample Output
1 0 0 0
1 1 0 0
0 1 0 0
0 1 1 1
0 0 0 1
the output array consist of only 1’s and 0’s and in your code it’s printing X’s as well .
if you want to do it in the same array then before printing you have to remove all X’s from the array .
i hope i have cleared your doubt !!