How is the output 1 for a=1,b=1, it should be 0, as there is no path?


#1

how is the output 1 for a=1,b=1, it should be 0, as there is no path?


#2

The start and the end positions are the same. So, a path does exist which has just one position ( = (1,1) ).


#3

Anshuman Singh I still disagree. There cannot be a path if initial and final points are same.


#4

Suyash Ahuja Do you think looking at a formal definition of a path would help ?
Path in my understanding is a sequence of vertices ( in this case grid cells ) where each neighbor in the sequence is connected directly. In this case, the sequence just has one vertex.


#5

Anshuman Singh then answer to 1 2 should be 2.


#6

Amit Kumar Can you list the 2 paths from (1, 1) to (1, 2) ?