Only 3 cases passed

So in this ques what we are interested in finding is first we check if right ans exists or not… means if we can go both bottom and right we prefer right as stated in question.
refer to my soln https://ide.codingblocks.com/s/592632
hope it clears all ur doubts…

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.