In this question rat can go in all 4 directions, I am not able to find a approach to solve this question, I have made a wrong code that will fail when there are cycles in the path
what is the correct approach for this problem?
Rat chases its cheese
Hello @sktg99,
You have made the logic for movement very complicated.
You can refer to the following code for the understanding the logic:
Let me know if you don’t understand something.
Hope, this would help.
Give a like, if you are satisfied.
okay thanks i understood
but why your code is not giving any output for the input:
3 3
OOO
OOO
OOO
okay sorry its working fine
Hey @S18ML0016 in your code as you went down->right->up->left is there any logic to this order or we can change this.
and since a unique path exists in this case is backtracking necessary.
Hello @mikki18,
No, you cannot change that order as a unique path is required.
The order should have been specified in the question itself.
What I did while solving this question was hit and trial.
Hope, it will help.
Hello Virender,
When I submit this code on Hackerblocks,one of testcase is not passed. Please help
My doubt has been been resolved.thanks for your help
Here, we have to find intersection point of Linked List ,please help
Hey @naru_here.
Right now i cannot open the problem.
I have conveyed it to the Tech team.
Will soon help you.
PLEASE TELL MY MISTAKE!
You can’t solve it greedily.