dsa · medium

Snake-and-Ladder Board Generator

GreyOrangeDesignMath

GreyOrange **Principal 2025 Gurgaon LLD**. generate_board(n, seed) → n×n board. Cells labeled 1..n² boustrophedon from bottom-left (same as LC 909). -1 = no teleport; a positive number is a destination cell.

Arguments

**Do not call random().** Same (n, seed) ⇒ identical board. Cell 1 and cell n² must stay -1. Destinations in 1..n², never self.

Use a seeded LCG: x = (1103515245 * x + 12345) & 0x7fffffff starting from seed.

**Example**

`` Input: 1 0 Output: [[-1]] ``

Constraints

1 <= n <= 20 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
1
0

Expected:
[[-1]]

Open in the Dojo editor