← Meta Interview Insights

Meta·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
May 2026

Summary

Meta software engineer OA with an AI-assisted coding environment. Five maze sub-questions back to back, and I ran out of time before the last one. The AI tooling was more of a hindrance than a help.

Questions Asked (5)

Q1

Add a null check to an existing function and print the result, based on a provided unit test.

Algorithms & Data Structures
Author's notes

Spent way too long just reading the unit test to figure out what was expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, carefully read the unit test to understand the expected behavior, especially how null inputs should be handled and what output is expected. Then, modify the function to add a null check that returns or prints the appropriate result, ensuring it aligns with the test's assertions. Finally, run the test to verify correctness and discuss edge cases.

Pro tip: Mention that null checks should be explicit and early to avoid NullPointerExceptions, and consider using Optional or similar constructs if appropriate for the language. Also, emphasize the importance of writing tests for null inputs if not already covered.

1. Understand the unit test

Read the provided unit test to determine the expected behavior when the input is null, including any specific output or return value.

2. Locate the function

Identify the existing function that needs modification and understand its current logic and signature.

3. Add null check

Insert a conditional at the beginning of the function to handle null input, such as returning a default value or printing a message, based on the test's expectations.

4. Print or return result

Ensure the function prints the result as required by the test, which may involve printing the output of the null check or the normal computation.

5. Verify with test

Run the unit test to confirm the modification passes, and consider additional edge cases like empty strings or other invalid inputs.

Key Points to Mention

  • Importance of reading and understanding the unit test first
  • Explicit null check to prevent NullPointerException
  • Returning or printing a sensible default for null input
  • Ensuring the function's behavior matches the test's assertions
  • Considering edge cases and writing additional tests if needed
  • Using language-specific features like Optional in Java or null-conditional operators in C#

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Navigate a maze that contains obstacles, finding a valid path from start to finish.

Algorithms & Data Structures
Author's notes

Standard grid traversal.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the maze representation (grid, start/end, obstacles) and constraints (size, movement rules). Then choose an appropriate algorithm like BFS for shortest path or DFS for any path, and discuss complexity and trade-offs. Implement cleanly with edge cases and test.

Pro tip: Demonstrate awareness of real-world constraints: if the maze is huge, BFS may be memory-heavy; consider bidirectional BFS or A* with a heuristic. Also, mention that DFS can get stuck in deep paths and may not find the shortest path.

1. Clarify the problem

Ask about maze representation (2D grid, adjacency list), movement allowed (4-directional, 8-directional), and whether we need any path or shortest path. Confirm start and end points and obstacle representation.

2. Choose algorithm

For shortest path, BFS is optimal for unweighted grids; for any path, DFS works but may be less efficient. Discuss trade-offs: BFS uses more memory, DFS may recurse deeply. Consider A* if heuristic available.

3. Outline approach

Describe steps: initialize queue/stack with start, track visited to avoid cycles, explore neighbors, and reconstruct path using parent pointers. Handle edge cases like no path, start=end, or blocked start/end.

4. Analyze complexity

State time and space complexity: O(V+E) for BFS/DFS, where V is number of cells and E is edges (up to 4V). Space O(V) for visited and queue/stack.

5. Implement and test

Write clean code with helper functions, then test with simple cases, no path, and large maze. Mention potential optimizations like bidirectional BFS or A*.

Key Points to Mention

  • BFS guarantees shortest path in unweighted graphs; DFS does not.
  • Use a visited set to avoid infinite loops and redundant work.
  • Path reconstruction via parent pointers or by storing paths in queue.
  • Edge cases: start or end blocked, no path exists, start equals end.
  • Complexity: O(V+E) time, O(V) space for BFS/DFS.
  • Alternative algorithms: A* with Manhattan distance heuristic, bidirectional BFS.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Navigate a maze where cells contain directional arrows that constrain which moves are allowed.

Algorithms & Data Structures
Author's notes

This one was actually interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the maze as a directed graph where each cell has at most one outgoing edge based on its arrow. Use cycle detection (DFS with colors or topological sort) to determine if a path exists from start to end, or if the start is in a cycle that doesn't reach the end.

Pro tip: Clarify whether the maze is static or if arrows can change, and discuss both DFS and BFS trade-offs. Mention that since each cell has out-degree ≤ 1, the graph is a functional graph, enabling efficient cycle detection with O(1) extra space using Floyd's algorithm.

1. Clarify problem constraints

Ask about maze size, whether arrows are fixed, if multiple arrows per cell exist, and if the goal is to determine reachability or find the actual path.

2. Model as a graph

Represent each cell as a node and add a directed edge from a cell to its neighbor in the direction of its arrow. Note that each node has out-degree at most 1.

3. Choose an algorithm

Use DFS with visited states (unvisited, visiting, visited) to detect cycles and reachability, or BFS if the graph were not functional. For functional graphs, consider Floyd's cycle detection for O(1) space.

4. Handle edge cases

Consider start equals end, start leads out of bounds, cycles that don't include the end, and multiple paths merging (though out-degree ≤ 1 prevents branching).

5. Analyze complexity and optimize

Time complexity is O(N) where N is number of cells; space can be O(N) for visited set or O(1) with Floyd's algorithm. Discuss trade-offs and potential optimizations.

Key Points to Mention

  • Graph representation: cells as nodes, arrows as directed edges
  • Cycle detection using DFS with three states (white, gray, black)
  • Functional graph property: each node has out-degree ≤ 1
  • Floyd's cycle detection algorithm for O(1) space
  • Time and space complexity analysis
  • Edge cases: start equals end, out-of-bounds moves, cycles not reaching end

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Navigate a maze that combines both obstacles and directional arrows.

Algorithms & Data Structures
Author's notes

Basically Q2 and Q3 merged.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the maze as a graph where each cell is a node and moves are determined by obstacles and directional arrows. Use BFS to find the shortest path, handling arrows that force a specific direction and may create cycles. Clarify edge cases and constraints before coding.

Pro tip: Discuss how to handle cycles caused by arrows, such as marking visited states with direction or using a distance array that tracks the minimum steps to reach each cell. This shows you consider infinite loops and optimize the search.

1. Clarify the problem

Ask about maze representation, arrow behavior (e.g., forced moves, one-time use), start/end points, and movement rules. Confirm if arrows can be traversed multiple times and if obstacles are static.

2. Model as a graph

Represent each cell as a node. For normal cells, edges go to adjacent non-obstacle cells. For arrow cells, the only outgoing edge is in the arrow's direction (if not blocked).

3. Choose BFS for shortest path

Since all moves cost 1, BFS from the start will find the shortest path. Use a queue and a visited set (or distance array) to avoid revisiting cells.

4. Handle cycles and arrow constraints

Arrows may create cycles. Ensure visited states are tracked correctly; if arrows can be used only once, include arrow usage in the state. Otherwise, standard BFS suffices.

5. Analyze complexity and edge cases

Time complexity is O(R*C) for BFS. Discuss edge cases: no path, start/end on arrows, arrows pointing into walls, and multiple arrows.

Key Points to Mention

  • Graph modeling: cells as nodes, moves as edges
  • BFS for unweighted shortest path
  • Handling directional arrows as forced moves
  • Cycle detection and visited state management
  • Time and space complexity: O(R*C)
  • Edge cases: unreachable target, arrows at boundaries, start/end on special cells

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

Navigate a maze that includes bombs, which detonate and clear surrounding walls or obstacles when triggered.

Algorithms & Data Structures
Author's notes

Never got to this one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the maze as a graph where each cell is a node, and bombs create dynamic edges by removing walls when detonated. Use BFS to find the shortest path, treating bomb detonations as state changes that can open new paths, and consider the order of bomb detonations to minimize steps.

Pro tip: Clarify whether bombs can be detonated remotely or only when stepped on, and whether detonations are permanent; this affects whether you need to track state or can precompute all possible paths.

1. Clarify problem constraints

Ask about maze size, bomb behavior (trigger condition, blast radius, permanence), and whether the goal is to find any path or the shortest path.

2. Define state representation

Decide how to represent the maze state, including which walls are destroyed. If bombs are limited, include bomb count or detonation status in the state.

3. Choose search algorithm

Use BFS for shortest path in an unweighted graph. If state space is large, consider A* with a heuristic like Manhattan distance to the exit.

4. Handle bomb detonation logic

When a bomb is triggered, update the maze by removing walls in its blast radius. Ensure the search explores both detonating and not detonating if bombs are optional.

5. Analyze complexity and optimize

Discuss time and space complexity. If state space explodes, consider techniques like bidirectional search or precomputing connected components after each bomb.

Key Points to Mention

  • Graph modeling: cells as nodes, walls as blocked edges, bombs as edges that can be removed.
  • BFS for shortest path, with state including bomb detonation status if bombs are limited.
  • State space explosion: if many bombs, use bitmask or other compression to represent detonated bombs.
  • Heuristic search (A*) with Manhattan distance for large mazes.
  • Edge cases: no path exists, bombs can destroy the exit, multiple bombs interact.
  • Time and space complexity: O(R*C*2^B) if B bombs, optimize with bidirectional BFS or meet-in-the-middle.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.