what is my error here?
Snake and ladder game
@chaman9
Your logic is correct but there is one mistake. You are intialising dist[node]=INT_MAX only for those node from while an edge originates. Since there is no node which originates from dest, thus it’s dist[dest] remain zero. So change line 21 to 25 from these lines
for(int i=0;i<=dest;i++)
{
dist[i]=INT_MAX;
}
your code will work
i didnt get you properly… and if i make change from line 21 to 25 the code isnt working either
please check
thank you my doubt my cleared… but in line number 53 why you added board size as n+1??
@chaman9
check line 73, range of j can be upto n. So size of board must be greater than or equals to (n+1).
okay thanks a lot it has been solved
yeaah its done thanks