InterviewLegend

Crawling the URL Maze Over HTTP

Alex Chen60 min readGuide updated
In this lesson
  • Crawl a maze of HTTP endpoints with BFS and a visited set
  • Retry flaky 503s with a bound and exponential backoff
  • Survive junk bodies, mixed formats and different URL forms
  • Open 401 doors with keys found later in the crawl
  • Return the shortest route and crawl concurrently under a rate limit

Ramp's live phone screen keeps coming back to one problem. You get a starting URL. A GET on it returns JSON that points at more paths, and you keep exploring until some page says something like "congrats". It's the Ramp coding problem candidates report most, all through 2026 and as recently as September. Most meet it in the hour-long phone screen. It has also turned up in onsite coding rounds, and an AI engineer met it in a July 2026 final round.

You already know the algorithm. It's a breadth-first search with a visited set. A September 2026 candidate said most of the time goes to the HTTP client and JSON parsing. Pages answer 503 and then work on the next try, bodies arrive as junk, and a door answers 401 until you carry a key you picked up three rooms back. A March 2026 candidate who got an offer put it this way: "You have to interact with real systems that are not part of an isolated code window."

Below, the base crawl and five follow-ups run as Python problems against a fake server, so the tests can throw 503s and junk at you the way the live service does. They stack in the order the parts tend to arrive. Work them on a timer and carry your code forward.

The Ramp angle
Pace yourself for the follow-ups. The parts are medium, and the score is how many you finish. Get part one running in about 20 minutes so the follow-ups have room.

What the Ramp phone screen asks

The prompt is short. You're handed an entrance, usually a base URL and a start path. A GET returns a JSON body. Some bodies list the next paths under a key like next_stops, some list ids you append to the base URL, and one says something like {"message": "congrats"}, which means you return the URL that produced it. Paths loop back on each other, and plenty lead nowhere.

The details drift between interviewers. One February 2026 candidate was told to return only the final URL and skip the route. In September 2026 the pages fed step ids instead of paths. A July 2025 version had a single chain, where a revisit meant a loop and the answer followed an END marker. Learn the shape and expect the key names to change.

New grads and interns get the same family. A January 2026 new grad screen was a BFS-style traversal across nested APIs, and an August 2025 intern called theirs an "API interaction hashmap and DFS question." On LeetCode the closest relatives are Web Crawler (1236) and Web Crawler Multithreaded (1242). They share the BFS and the visited set and stop there. Retries, junk bodies and locked doors are missing, and candidates lose the Ramp round on those.

Ask before you write code

Interviewers differ a lot here. A September 2026 candidate got no clarifying hints at all, and a June 2026 candidate had to discover new response types, body formats and URL schemes as the exercise went on. Other 2026 candidates describe friendly interviewers who were happy to talk it through. Documentation rules vary too. A September 2026 intern was allowed to look up Python docs, a June 2026 candidate was discouraged from it, and Ramp's intern FAQ calls its interviews open book. Settle it in the first two minutes.

  • Can I look up the HTTP library docs, or should I work from memory?
  • Does a GET return paths, full URLs or ids, and what is the base URL?
  • What marks the exit, and do you want the URL, the message or the route?
  • Which status codes should I expect, and which are worth retrying?
  • Can the maze loop back on itself?

Then print the raw response before you parse anything. Two February 2026 candidates gave the same advice, since a 503 body can be malformed and a blind .json() call throws on it. The printout also shows you the next surprise before your code trips on it.

Keep fetching apart from crawling. One small get(path) function owns the HTTP call, the retries, the auth and the parsing, and the BFS loop only ever sees a status and a body. Most follow-ups below then change one of the two halves and leave the other alone.

Testing without the live service

A February 2026 candidate was asked for tests and follow-up code, and a September 2026 screen added testing without the live service as a follow-up. Keeping fetching apart from crawling answers it. Pass the fetch function in, and a test hands the crawler a dict instead of the network.

python
import requests
def http_get(url):
response = requests.get(url, timeout=5)
try:
return response.status_code, response.json()
except ValueError:
return response.status_code, None # junk body: the crawler decides
def fake_get(pages):
def get(url):
if url not in pages:
return 404, None
return 200, pages[url]
return get
# live: crawl(http_get, "https://maze.example.com/start")
# test: crawl(fake_get({"/": {"next_stops": ["/a"]}, "/a": {"message": "congrats"}}), "/")

Each practice problem below works exactly that way. You get the fake server as a dict, which lets a test script a page that fails twice and then answers.

Asked at Ramp

Six problems, each one a part you might be handed next. Solve each before you read the one after it.

The base crawl

Nearly every version, from March 2025 to September 2026, starts with this crawl. GET the start, follow the next paths, return the page that says congrats. A September 2025 senior candidate finished it in 20 minutes and then got a bonus part with more HTTP calls and edge cases. Plan on that pace.

1

Escape the URL Maze

MediumSignature problem
Problem
Write escape_maze(server, start). The maze is a fake HTTP server. server maps each path to the JSON body a GET on it returns, already decoded. A path missing from server answers 404 and is a dead end.

A body is either {"next_stops": [paths]}, listing the paths you can visit next, or an object with a message field. The exit is the page whose message is "congrats". Any other message is a dead end, and so is an empty next_stops list.

Start at start and explore with BFS, following next_stops in the order listed. Paths can loop back to pages you've seen. Return the exit's path, or "" if no page you can reach is the exit. At most one page is the exit.
Inputserver = {"/": {"next_stops": ["/a", "/b"]}, "/a": {"next_stops": ["/c"]}, "/b": {"next_stops": []}, "/c": {"message": "congrats"}}start = "/"Output"/c"

/ leads to /a and /b. /b is a dead end, and /a leads to /c, which says congrats.

How this uses the pattern

BFS with a deque and a visited set. Mark a path as seen when you queue it, and treat anything other than a 200 as a dead end.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Escape the URL Maze

Loading...
Click "Run" to execute your code
The Ramp angle
Candidates keep saying the algorithm is the easy part. The September 2026 candidate who said most of the time went to the HTTP client wrote recursive DFS and said they'd pick BFS next time. BFS earns that twice. A queue never hits Python's recursion limit on a long corridor, and it finds the shortest route with no extra work, which may be a later part. Mark a path seen when you queue it. Marking on visit lets one page sit in the queue several times, and each copy costs a network call.
Take it further
Why does the recursive version crash? A September 2026 follow-up asked exactly this. Python's default recursion limit is about 1,000 frames, so a corridor a few thousand rooms long raises RecursionError. An explicit stack gives you depth-first order with no recursion, worked through below.

Flaky 503s

Retries are the part 2026 candidates name most. February, April and September 2026 candidates all describe pages that answer 503 and then work on a retry. A September 2026 candidate who skipped every 503 never found the exit. The July 2026 onsite version adds backoff, deadlines and retry budgets.

2

Retry Flaky 503s With Backoff

MediumSignature problem
Problem
Write escape_with_retries(server, start, max_retries, base_wait). Now server maps each path to a list of replies, each one [status, body]. The first GET to a path gets the first reply and the second GET the second. Once the list runs out, the last reply repeats. A path missing from server answers 404.

A 503 is temporary, so retry it up to max_retries times after the first try. Before retry k, counting from 0, wait base_wait * 2 ** k milliseconds. Any status other than 200 or 503 is a dead end with no retry. A failed reply's body can be junk, so read the body only on a 200.

Crawl with BFS as before and return a log with one line per event. Write "GET " for each request and "WAIT " for each backoff, then end with "EXIT " or "NO EXIT". There is no wait after the last failed try.
Inputserver = {"/": [[200, {"next_stops": ["/a", "/b"]}]], "/a": [[503, ""], [503, ""], [200, {"next_stops": ["/exit"]}]], "/b": [[200, {"next_stops": []}]], "/exit": [[200, {"message": "congrats"}]]}start = "/"max_retries = 3base_wait = 100Output["GET / 200", "GET /a 503", "WAIT 100", "GET /a 503", "WAIT 200", "GET /a 200", "GET /b 200", "GET /exit 200", "EXIT /exit"]

/a answers 503 twice. The waits double from 100 to 200, and the third try returns the link to /exit.

How this uses the pattern

Put the retry loop inside get, so the BFS only ever sees the final status. Loop over max_retries + 1 tries and double the wait each time.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Retry Flaky 503s With Backoff

Loading...
Click "Run" to execute your code
The Ramp angle
That September 2026 candidate was warned only that a URL can answer 503 once and work on the retry. Nothing more. So treat 503 as temporary from the first minute, and ask which other codes count. Most 2026 candidates mention only 503. A May 2026 onsite retried server failures in general, and a July 2025 version retried 500 too. Bound the retries, because a September 2026 follow-up asks about a step that always answers 503, and an unbounded loop hangs on it. Exponential backoff is the default people expect.
Take it further
One retry budget for the whole crawl. The July 2026 onsite version adds retry budgets and deadlines. Give the crawl a total number of retries to spend, stop a page when either its own limit or the shared budget runs out, and add jitter so many workers don't retry in lockstep. Worked below.

Junk bodies and mixed formats

In February 2026 two candidates hit malformed content and 503 bodies that weren't valid JSON. One of them got bodies that were the bare string congrats or a list of new URLs. In June 2026 a candidate watched new body formats and URL schemes appear as the exercise went on. This part bundles those cases.

3

Parse Whatever the Maze Sends Back

MediumFrequently asked
Problem
Write escape_any_format(server, host, start). Now server maps each path to the raw text a GET returns, and every known path answers 200. A path missing from server is a dead end.

A page is the exit when it says congrats as raw text, as a JSON string, or as the message of a JSON object. Compare after trimming spaces and ignoring case. Otherwise the links come from a JSON list, or from the next_stops list of a JSON object. Skip any link that isn't a string.

Everything else is a dead end. That covers text that doesn't parse, other JSON values, and a next_stops that isn't a list.

Links take three forms. /c is a path, c is the same path without its slash, and https://maze.test/c or http://maze.test/c is a full URL on the maze host, given as host. A bare https://maze.test means /. Skip full URLs on any other host. Explore with BFS in link order and return the exit's path, or "".
Inputserver = {"/": "[\"/a\", \"b\"]", "/a": "<html>oops</html>", "/b": "{\"next_stops\": [\"https://maze.test/c\"]}", "/c": "congrats"}host = "maze.test"start = "/"Output"/c"

"b" becomes /b, the HTML page is a dead end, and the full URL on maze.test becomes /c.

How this uses the pattern

Write one read(text) function that returns (is_exit, links) and never raises, plus a to_path(link) that returns None for other hosts. The BFS is unchanged.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Parse Whatever the Maze Sends Back

Loading...
Click "Run" to execute your code
The Ramp angle
Expect the body to change under you. The June 2026 candidate who saw new formats appear had to find each new case as it showed up, and printing what came back is how you see it first. Parse defensively in one place. Wrap the decode in a try, check the type of everything you pull out, and decide on purpose what counts as a dead end. A crawler that throws on one bad page loses the run, and an interviewer adding a new body type finds that throw fast.
Take it further
Ids instead of paths. A September 2026 version returned next_steps ids that you append to the base URL, so 17 means base_url/17. That's one more branch in read and nothing else, shown below.

Locked doors and keys

April and July 2026 candidates describe auth. In April the interviewer swapped in a new URL that threw 503s and 401s, and in part three some URLs returned a key you had to send in a header on later requests. That candidate passed part one and ran out of time debugging part three. The July 2026 AI engineer final round had a similar second level, with auth headers collected as you crawl.

4

Collect Keys to Open 401 Doors

HardFrequently asked
Problem
Write escape_with_keys(server, locks, start). server maps paths to decoded bodies as in part one, and a body may also carry a key field that names a key. locks maps some paths to the key they need.

A GET to a locked path answers 401 unless you already hold its key. Once you've read a body with a key, you hold it for every later request. A 401 doesn't say which key it wants, and a key can turn up after you've met its door.

Crawl with BFS and return the exit's path, or "" if you can't reach it. A body whose message is "congrats" is the exit, and the exit itself can be locked.
Inputserver = {"/": {"next_stops": ["/door", "/hall"]}, "/door": {"next_stops": ["/exit"]}, "/hall": {"next_stops": [], "key": "blue"}, "/exit": {"message": "congrats"}}locks = {"/door": "blue"}start = "/"Output"/exit"

/door answers 401 at first. /hall hands over the blue key, so /door goes back on the queue and opens.

How this uses the pattern

A 401 is a door to come back to. Park those paths in a list, and each time you pick up a key you did not have, push them all back onto the queue.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Collect Keys to Open 401 Doors

Loading...
Click "Run" to execute your code
The Ramp angle
The April 2026 candidate lost the round on this step, so make it boring. Keep the key store next to get, so each request sends what you hold and the BFS never learns auth exists. Never drop a 401 as a dead end, since the door may open once a key turns up elsewhere. Parking those paths and re-queuing them on each new key keeps it to one BFS. Searching over pairs of room and key also works. Parking is less code.
Take it further
The key goes in a header. Live, a body hands you a token and later requests need it in a header like Authorization: Bearer , so keep a headers dict beside get and merge each new token in. The July 2026 version also raised token safety, so keep tokens out of the lines you print while debugging.

The shortest route

September 2026 screens added the shortest route as a follow-up, once as the shortest sequence of step ids, and a May 2026 onsite made it the main ask. In February 2026 a candidate was told the opposite for part one, to return just the final URL. Ask which one they want before you build the route.

5

Shortest Route Out of the Maze

MediumCommonly asked
Problem
Write shortest_route(server, start), with server as in part one. Return the list of paths from start to the exit, both included, using as few hops as possible. Return [] when there's no exit.

If two routes tie, return the one BFS finds first when it follows next_stops in listed order. A path missing from server is a dead end. The start can be the exit, in which case the route is just [start].
Inputserver = {"/": {"next_stops": ["/a", "/b"]}, "/a": {"next_stops": ["/c"]}, "/b": {"next_stops": ["/exit"]}, "/c": {"next_stops": ["/exit"]}, "/exit": {"message": "congrats"}}start = "/"Output["/", "/b", "/exit"]

/b reaches the exit in two hops. The route through /a and /c takes three.

How this uses the pattern

BFS already reaches every page by a fewest-hop route. Record each page's parent the first time you queue it, then walk parents back from the exit.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Shortest Route Out of the Maze

Loading...
Click "Run" to execute your code
The Ramp angle
If part one used BFS, this part is a dict and five lines. Record each path's parent when you first queue it, then walk back from the exit. Candidates who wrote DFS for part one have to restart here, because DFS finds a route with no promise it's the shortest. Storing the whole route inside each queue entry also works. On a large maze it copies a growing list for every page, and the parent dict doesn't.
Take it further
A million steps. One September 2026 follow-up scales the maze to a million steps. The parent dict stays one entry per page, so memory grows with the page count and the depth doesn't matter. At that size the run time is almost all network, which is where the next part comes in.

Concurrency under a rate limit

September 2026 screens ended with scale: a million steps with ten requests in flight, a concurrent crawler whose visited set stays correct, and retries adjusted under rate limiting. Live, you'd talk this through or reach for a thread pool. Here it runs on a simulated clock so the tests can check it.

6

Crawl Concurrently Under a Rate Limit

HardCommonly asked
Problem
Write crawl_ticks(server, start, workers, limit, window), with server as in part one. Time moves in ticks numbered from 1. In each tick you send requests for paths taken from the front of the BFS queue, all at once, and every reply arrives by the end of that tick.

Two caps decide how many you send. At most workers requests can be in flight in one tick. The server allows at most limit requests in any window consecutive ticks, so count what you sent in the previous window - 1 ticks. If the caps leave no room, the tick passes with nothing sent.

At the end of a tick, handle the replies in the order you sent them and queue unseen next paths as before. Return the tick in which the exit's reply arrived, or -1 if the queue runs dry first. workers, limit and window are all at least 1.
Inputserver = {"/": {"next_stops": ["/a", "/b", "/c"]}, "/a": {"next_stops": ["/a1"]}, "/b": {"next_stops": ["/b1"]}, "/c": {"next_stops": ["/c1"]}, "/a1": {"next_stops": []}, "/b1": {"next_stops": []}, "/c1": {"next_stops": ["/exit"]}, "/exit": {"message": "congrats"}}start = "/"workers = 1limit = 100window = 1Output8

One worker sends one request per tick, so the exit arrives in tick 8, its place in BFS order.

How this uses the pattern

Keep a list of how many requests went out in each tick. The room this tick is limit minus the sum of the last window - 1 entries, capped by workers and by the queue length.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Crawl Concurrently Under a Rate Limit

Loading...
Click "Run" to execute your code
The Ramp angle
The concurrency question is mostly about the visited set. With ten workers, two can pop sibling pages that both link to the same room, and both will fetch it unless the room is marked seen the moment it's queued, by one owner. Sending past the rate limit only buys 429s and wasted retries, so send what the window allows and no more. Live, that's a cap on in-flight requests plus a sliding-window counter checked before each send.
Take it further
The threaded version. The same crawl with a thread pool, one BFS level at a time, is below. For the rate limit, describe a shared sliding-window counter behind a lock that each worker checks before it sends.

How the round is scored

The score is how many parts you finish, and how cleanly. How Ramp decides covers the bar. A February 2026 candidate was told style matters less than getting the core logic working fast.

Run it after every part. Print each response while you build, get part one green, and then extend that code. A rewrite in the middle of the hour costs the part you would have finished. Talk while you type, especially when you choose BFS and when you decide which codes to retry.

Common questions

What is the Ramp URL maze question?

It's the most reported Ramp phone screen problem in 2026. You start from a URL, GET it, and follow the paths in its JSON body until a page returns something like a congrats message. Later parts add 503s that work on retry, junk bodies, 401s that need a key found earlier, the shortest route and concurrency.

Is the Ramp technical interview LeetCode style?

Mostly not. The live screen is usually a practical build in parts, like the maze, and LeetCode's Web Crawler problems are only its closest relatives. A couple of April 2026 candidates did get a plain data-structures problem on their screen, so keep BFS, hashing and sorting warm as well.

Which language should I use for the Ramp phone screen?

Any language whose HTTP client you know cold. Python is the common choice, and one September 2026 screen ran in CoderPad. Know how to send a GET with headers, read the status code, and catch a failed JSON decode without looking anything up, since docs may not be allowed.

How do I practice the Ramp coding interview maze?

Write the crawler from a blank file, then point it at a small local server you script to throw 503s, junk bodies and a locked door. Python's http.server takes a few lines for that. Time yourself. Part one in about 20 minutes leaves the rest of the hour for the follow-ups.

Key Takeaways

  • ✓Ramp's 2026 phone screen is most often a maze of HTTP endpoints. BFS with a visited set solves part one.
  • ✓Retry 503s with a bound and backoff, read bodies only on a 200, and treat junk as a dead end.
  • ✓Park paths that answer 401 and queue them again each time you pick up a new key.
  • ✓Keep fetching apart from crawling, so each follow-up and each test changes one small function.
Ramp interview guide

Know what Ramp asks before you walk in.

29 coding · 3 system design · 18 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

More CodeSignal Builds: Files, Tasks & RecipesHad your Ramp interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.