Shortest Route Through an Obby With Paired Teleporters
Last updated: November 29, 2026
Quick Overview
An obstacle course is a grid with walls '#', open cells '.', a start 'S', an end 'E', and lowercase letters marking teleporter pads where stepping onto a pad lets you jump to any other pad with the same letter for one move. Return the minimum number of moves from S to E, or -1 if unreachable.
Roblox
November 29, 20260
0
0 solved
An obstacle course is a grid with walls '#', open cells '.', a start 'S', an end 'E', and lowercase letters marking teleporter pads where stepping onto a pad lets you jump to any other pad with the same letter for one move. Return the minimum number of moves from S to E, or -1 if unreachable.
Obbies are one of the most popular genres on Roblox, so grid pathing with a twist is a common screen format. The interviewer wants BFS on an implicit graph, correct handling of extra edges, and awareness of the worst case when many pads share a letter.
What the Interviewer Expects
- Model the grid as an unweighted graph and choose BFS
- Precompute teleporter positions by letter
- Add teleport edges as unit-cost moves
- Mark visited on enqueue to avoid duplicates
- Discuss the many-pads-per-letter performance trap
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- If thousands of pads share a letter, how do you avoid quadratic edge scans?
- What if teleporting costs zero moves instead of one?
- How would you return the actual path for a replay ghost?
- What changes if some cells are lava that cost 3 moves to cross?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Moves are up, down, left, right onto non-wall cells, each costing 1. Standing on pad a, one move can also take you to any other a pad. Walking onto a pad does not force a teleport. Return the move...
High-Level Design
All moves have equal cost, so BFS gives shortest paths. Each cell is a node; neighbors are the four adjacent cells plus, for pad cells, the other pads of that letter. A dictionary from letter to posit...