Code · Interview problems · Problems
Snake and Ladder
Question
Model a Snake and Ladder game: an n x m board with snakes (head to tail) and ladders (start to end), players with positions, and a 1-6 dice. (Entity notes only so far.)
Key insight
Entities first: Board, Snake, Ladder, Player, Dice, Game.
SnakeAndLadderProblem.java 16 lines GitHub ↗
/**
* Problem: Snake and Ladder
* Difficulty: Medium
* Topic: Simulation / LLD
* Question: Model a Snake and Ladder game: an n x m board with snakes (head to tail) and ladders (start to end), players with positions, and a 1-6 dice. (Entity notes only so far.)
* Insight: Entities first: Board, Snake, Ladder, Player, Dice, Game.
*/
package dsa;
public class SnakeAndLadderProblem {
// snake - head and tail
// ladder - start and end
// player - userid , position
// board - n*m
// dice - (1 to 6)
// game -
}