Shortest-source-to-destination-path

https://practice.geeksforgeeks.org/problems/shortest-source-to-destination-path/0

code link

why is this code showing tle on submission??plz correct the code along with explaination…

As you have multiple test cases you either have to initialise all the arrays in the function or of it is global initialize it with some infinity value before calling the function. And also initiaize your visited array with zero in each test case

plz tell me how to pass a 2d array to function with the same size taken as input by user(diff no of rows and col) and then input of 2d array is alsoTaken from user …
provide its code as well…as i am unable to pass the array with the same size …

No need to pass as you are using a global array just initialize it with zero before the beginning of each test case

But in case I want to pass it then provide its code …

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.