My solution: https://ide.codingblocks.com/s/476542
Question: https://online.codingblocks.com/app/player/178555/content/173732/5020/code-challenge
Test-cases 2, 4 passed.
Test-cases 0,1 and 3: wrong answer.
My solution: https://ide.codingblocks.com/s/476542
Question: https://online.codingblocks.com/app/player/178555/content/173732/5020/code-challenge
Test-cases 2, 4 passed.
Test-cases 0,1 and 3: wrong answer.
hello @mohaktrivedi
since rst can move in all 4 directions, ur solution may stuck in infinite loop because u may vizit some point thzt u alresdy visited before.
so to avoid it, return false if u visit any cell that is visitef before
@aman212yadav Tried it. Still getting the same results.
When I compiile and test it against given e.g. input, I get wrong o/p NO PATH FOUND.
in line 25 it should be==
@aman212yadav oh right!
But now, I’m getting TLE for 0,2,3 test cases and I’m getting wrong answer for 1,4 test cases.
My new approach: https://ide.codingblocks.com/s/476572
Tried with e.g. input.
5 4
OXOO
OOOX
XOXO
XOOX
XXOO
Expected output:
1 0 0 0
1 1 0 0
0 1 0 0
0 1 1 0
0 0 1 1
My output of new approach:
Matches the expected o/p
With old approach o/p was:
NO PATH FOUND
But, when I submit:
TLE for test-cases 0, 1, 2, 3
Wrong answer for test-case 4.
cbheck now->
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.