getting wrong answer .
please correct it .
i am not able to find the mistakes .
Snake and ladder
i didn’t get that what you are trying to say .
can you please elaborate more
@sk3657860 instead of
board[val] = some_val
do it like
board[val] += some_val
also, in BFS funcn if dist[dest] = INT_MAX then return -1
And check your input as well, first take input for number of ladders, then all the ladders.
then take input for number of snakes, then take input for all the snakes
Reference code: https://ide.codingblocks.com/s/290920
1 Like
i think there is no issue with board[val]= some_val;
i found my mistake . i was checking the if(j<=size){
g.addEdge(i,j);
}
outside of the inner for loop which is running over dice;
this is my corrected code and it pass all the test cases