All test case are passing but
one test case is not giving any output
One case not passing
send me the code link
in case there is no valid path
u need to print -1 on console
u have missed that condition
oops i missed that
but i kept waiting for your reply for to much time
sorry for the delay.
hope now ur code will work