PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Extend a Maze Solver

Last updated: Apr 16, 2026

Quick Overview

This question evaluates proficiency in implementing and debugging graph search algorithms and state-space modeling, including correct visited-state handling for BFS/DFS and integrating movement and environment mechanics such as directional tiles, keys/doors, and area-effect actions.

  • medium
  • Meta
  • Coding & Algorithms
  • Machine Learning Engineer

Extend a Maze Solver

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an existing grid-based maze solver with bugs and several requested feature extensions. The maze uses the following symbols: - `S`: start - `E`: exit - `#`: wall - `.`: open cell - `*`: rendered path overlay - `>` and `<`: direction-forcing cells - lowercase letters `a` to `z`: keys - uppercase letters `A` to `Z`: locked doors that require the matching lowercase key - `B`: bomb cell Complete the following tasks in the same codebase: 1. Fix path rendering so that `S` and `E` are never overwritten by `*` when printing the final route. 2. Fix the traversal algorithm so it does not loop forever because of incorrect visited-state handling in BFS or DFS. 3. Update movement rules so that when the current cell is `>` the next move must go right, and when it is `<` the next move must go left. 4. Extend the solver to support keys and doors. Reaching the same coordinate with different sets of collected keys must be treated as different search states. 5. Add bomb behavior: when the agent steps on `B`, all walls within Manhattan distance 2 are destroyed and become passable for the remainder of that search path. Implement the required fixes and explain the algorithm used at each stage, including how the search state must evolve as new mechanics are added.

Quick Answer: This question evaluates proficiency in implementing and debugging graph search algorithms and state-space modeling, including correct visited-state handling for BFS/DFS and integrating movement and environment mechanics such as directional tiles, keys/doors, and area-effect actions.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Feb 8, 2026, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
1
0
Loading...

You are given an existing grid-based maze solver with bugs and several requested feature extensions. The maze uses the following symbols:

  • S : start
  • E : exit
  • # : wall
  • . : open cell
  • * : rendered path overlay
  • > and < : direction-forcing cells
  • lowercase letters a to z : keys
  • uppercase letters A to Z : locked doors that require the matching lowercase key
  • B : bomb cell

Complete the following tasks in the same codebase:

  1. Fix path rendering so that S and E are never overwritten by * when printing the final route.
  2. Fix the traversal algorithm so it does not loop forever because of incorrect visited-state handling in BFS or DFS.
  3. Update movement rules so that when the current cell is > the next move must go right, and when it is < the next move must go left.
  4. Extend the solver to support keys and doors. Reaching the same coordinate with different sets of collected keys must be treated as different search states.
  5. Add bomb behavior: when the agent steps on B , all walls within Manhattan distance 2 are destroyed and become passable for the remainder of that search path.

Implement the required fixes and explain the algorithm used at each stage, including how the search state must evolve as new mechanics are added.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Machine Learning Engineer•Meta Machine Learning Engineer•Meta Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ 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.