Retryable URL Maze
Reported by candidates from Ramp's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks most first attempts at Ramp's Retryable URL Maze, reported in October 2026, is treating retries like extra graph nodes instead of a per-URL budget. This is BFS with a twist. Each URL has a fixed sequence of responses, you get maxRetries + 1 tries, and the first valid answer decides everything. If you're taking this OA soon, the shape is simple once you see it. Parse the rows into a map, run BFS with a visited set, and rebuild the path through parent pointers. StealthCoder sits as a safety net on the live OA if you blank on the details.
The problem
Model a URL maze with deterministic per-endpoint response sequences. Each row in responses is [url, attempt1, attempt2,...]. An attempt is: 503 or MALFORMED: failed attempt; NEXT:a,b,...: successful response listing next URLs; CONGRATS: terminal success. Starting at start, perform BFS with visited de-duplication. When a URL is dequeued, consume at most maxRetries + 1 attempts, stopping at its first valid NEXT or CONGRATS. An exhausted URL adds no neighbors. Return the first BFS path from start to a URL that yields CONGRATS. Preserve NEXT order for ties. Return an empty array when no success is reachable. Function solveUrlMaze(start: String, responses: String[][], maxRetries: int) → String[] Examples Example 1 start = "start" responses = [["start","503","NEXT:a,b"],["a","NEXT:c"],["b","CONGRATS"],["c","CONGRATS"]] maxRetries = 1 return = ["start","b"] The start succeeds on its retry; BFS reaches b before the deeper c path. Example 2 start = "start" responses = [["start","503","503"],["a","CONGRATS"]] maxRetries = 1 return = [] The start exhausts its two allowed attempts and exposes no neighbor. Constraints 1 <= responses.length <= 10^4. Every URL appears as the first field of at most one row. 0 <= maxRetries <= 20.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is separating two things. The outer loop is plain BFS over URLs. The inner loop is a bounded scan of that URL's response list. When you dequeue a URL, look at up to maxRetries + 1 entries. Skip 503 and MALFORMED. Stop at the first NEXT or CONGRATS. If none appears in the budget, the URL is a dead end and adds no neighbors. The common pitfall is checking CONGRATS when you enqueue instead of when you dequeue, or ignoring the budget and reading a later success. Another is forgetting that a URL with no row has no responses, so it's a dead end. Mark visited on enqueue, keep NEXT order, and store a parent map for the path. Return an empty array if the queue drains. If your mind goes blank mid-assessment, StealthCoder can supply the BFS skeleton while you adapt the retry loop.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Retryable URL Maze cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Ramp's OA.
Ramp reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Retryable URL Maze FAQ
How hard is Retryable URL Maze really?+
It's a medium. The BFS is standard. The difficulty is reading the retry rules carefully: a bounded attempt scan per URL, stopping at the first valid response. Candidates lose points on edge cases, not on the algorithm itself.
What's the core trick?+
Split the problem in two. BFS handles ordering and shortest path. A small helper resolves each URL by scanning at most maxRetries + 1 responses and returning the first NEXT or CONGRATS, or nothing if the budget runs out.
How do I return the path?+
Keep a parent map from each URL to the URL that first enqueued it. When you dequeue a URL whose resolved response is CONGRATS, walk parents back to start and reverse. BFS order plus NEXT order gives you the right tie-breaking.
What edge cases should I test?+
Test maxRetries = 0, a start that exhausts its attempts, a URL missing from responses, cycles between URLs, and a start that returns CONGRATS immediately. Also check that MALFORMED counts as a failed attempt and still uses up budget.
How do I prepare in 48 hours?+
Write BFS with parent pointers from scratch twice. Then code the bounded-retry helper separately and plug it in. Dry-run both examples by hand. That covers nearly everything this problem tests.