can t clear all the test cases due to run time. Not sure if dp will be applied or not
Run time error for some test cases
- increase the size of array to 1000 as mention in the question
- print -1 for those cases when there is no possible path
can t clear all the test cases due to run time. Not sure if dp will be applied or not