PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Chariot

Explore an HTTP Maze

Last updated: May 2, 2026

Quick Overview

This question evaluates the ability to integrate HTTP-based APIs with graph traversal and state management, covering concepts such as breadth-first exploration for shallow-first search, cycle avoidance, transient error handling, and key-lock resource constraints.

  • medium
  • Chariot
  • Coding & Algorithms
  • Software Engineer

Explore an HTTP Maze

Company: Chariot

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an HTTP API that represents a maze-like forest. The entrance is available at `GET /mirkwood`. Each location in the forest is identified by a string `id`. A `GET` request to a location returns JSON describing that location and the possible next moves. Your program must explore the forest until it reaches the exit, then print the final location id. Assume the API follows this contract: ```json { "id": "A", "message": "optional text", "neighbors": [ { "direction": "north", "url": "/mirkwood?location=B" }, { "direction": "east", "url": "/mirkwood?location=C" } ] } ``` The exit response contains: ```json { "id": "Z", "message": "DONE", "neighbors": [] } ``` Requirements: 1. Write a program that repeatedly sends `GET` requests, explores reachable locations, and stops when it receives a response whose `message` is exactly `"DONE"`. 2. Because the forest becomes more dangerous the farther you go, explore shallower locations before deeper ones. In other words, find the exit using breadth-first search. 3. Avoid infinite loops if the maze contains cycles. 4. Print the id of the final exit location. 5. Log enough information while exploring to debug unexpected API responses. Follow-up: A second endpoint uses the same maze idea but adds real-world API complications: - Some requests may fail temporarily with server errors such as HTTP `500`, `502`, or `503`. - Some doors are locked. A neighbor may contain `"locked": true` and `"required_key": "red"`. - Some locations contain keys, for example `"keys": ["red", "blue"]`. - A locked door can only be traversed after your program has collected the required key. Extend your program so it can still escape the maze while handling retries for transient failures, collecting keys, and revisiting locations when newly collected keys make additional paths available.

Quick Answer: This question evaluates the ability to integrate HTTP-based APIs with graph traversal and state management, covering concepts such as breadth-first exploration for shallow-first search, cycle avoidance, transient error handling, and key-lock resource constraints.

Chariot logo
Chariot
Apr 7, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

You are given an HTTP API that represents a maze-like forest. The entrance is available at GET /mirkwood.

Each location in the forest is identified by a string id. A GET request to a location returns JSON describing that location and the possible next moves. Your program must explore the forest until it reaches the exit, then print the final location id.

Assume the API follows this contract:

{
  "id": "A",
  "message": "optional text",
  "neighbors": [
    { "direction": "north", "url": "/mirkwood?location=B" },
    { "direction": "east", "url": "/mirkwood?location=C" }
  ]
}

The exit response contains:

{
  "id": "Z",
  "message": "DONE",
  "neighbors": []
}

Requirements:

  1. Write a program that repeatedly sends GET requests, explores reachable locations, and stops when it receives a response whose message is exactly "DONE" .
  2. Because the forest becomes more dangerous the farther you go, explore shallower locations before deeper ones. In other words, find the exit using breadth-first search.
  3. Avoid infinite loops if the maze contains cycles.
  4. Print the id of the final exit location.
  5. Log enough information while exploring to debug unexpected API responses.

Follow-up:

A second endpoint uses the same maze idea but adds real-world API complications:

  • Some requests may fail temporarily with server errors such as HTTP 500 , 502 , or 503 .
  • Some doors are locked. A neighbor may contain "locked": true and "required_key": "red" .
  • Some locations contain keys, for example "keys": ["red", "blue"] .
  • A locked door can only be traversed after your program has collected the required key.

Extend your program so it can still escape the maze while handling retries for transient failures, collecting keys, and revisiting locations when newly collected keys make additional paths available.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Chariot•More Software Engineer•Chariot Software Engineer•Chariot Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.