Snake and ladder problem geeksforgeeks


this question right ans is 3 but it give 2
where my code struct down tell?

Hello @khemchandrs

The target vertex is NOT “i + dice + board[i + dice]” but
if(board[i + dice] == 0) {
v = i + dice;
}else{
v = board[i + dice];
}

Here is the modified code