As reported: Splunk (Cisco) Software Engineer – Full Stack (2025), Karat assessment: Karat Core is a 60-minute live video interview — about 15 minutes of system-design discussion, then 45 minutes of coding; a redo is allowed. Second attempt, coding question 1: a one-dimensional board game — roll a die with a given number of sides once; teleporters move the player from one square to another; given the start and the end square, return the distinct positions the player can end up on.
Squares are numbered 0 … lastSquare. A die has dieSides faces (1 … dieSides). Each teleporter [from, to] moves a player who lands on from to to (forward or backward). From start, roll the die once and return the sorted list of distinct squares you can finish on.
Example 1
teleporters = [[3,1],[4,2],[5,10]], dieSides = 6, start = 0, lastSquare = 20
-> [1,2,6,10]
Rolls 1–6 land on 1, 2, 3→1, 4→2, 5→10, 6.
Example 2
teleporters = [[1,0],[2,0],[3,0],[4,0]], dieSides = 4, start = 0, lastSquare = 5
-> [0]
Clarifications
- A roll that would go past
lastSquareis not possible. - Teleporters do not chain: after a jump you stay on the target square, even if it has a teleporter.
- At most one teleporter starts on any square.
Constraints: 1 ≤ dieSides ≤ 20; 0 ≤ start ≤ lastSquare ≤ 2 · 10^5; teleporter squares are within 0 … lastSquare.
Code runner format: one JSON value per line: teleporters, dieSides, start, lastSquare. Implement destinations(teleporters, dieSides, start, lastSquare); the harness sorts your list and prints it.