You have to find out minimum cost required to reach from location A to location B and you are given a list of connected path
Each connected path cost 1 Unit to reach.
Eg:
Connected Path given : [ [1,2] [2,3] [3,5] [2,4] [1,4] [4,5] ]
find Min cost to reach from 1 to 5.
Here 2 Unit is min cost required to reach from 1 to 5.
You can go from 1 to 4 and then from 4 to 5 i.e 2 Unit