Snake and ladder Problem Graph

The Second taste case gives answer 6 required : 5.

@Mansi2103
DO the following changes

  1. change line 47 to if(dist[neighbours] > dist[node]+1);
  2. line no. 90 v[x]=(y-x);
  3. line no. 103 v[x]=(y-x);
  4. You haven’t considered the case when ans doesn’t exist in that case you have to print “-1”

I have modified your code, please check here

@Mansi2103
As i can see you have successfully submitted the code. pLease mark this doubt as resolved.

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.