AI & Technical question
Write an algorithm for a robot that has to get from point A to point B in a room.
- Microsoft
- AI & Technical
- Medium
Practice this question out loud. An AI interviewer asks it, follows up like a real interviewer would, and scores your answer. Type or speak.
Start a mock interview on this question · Mock interview from a job description
What this question tests
Tests basic algorithmic and technical reasoning for a classic pathfinding problem, expected at a conceptual rather than full-code level for a PM.
How to approach it
- Represent the room as a grid or graph, where each cell or node represents a traversable space and obstacles are marked as blocked.
- Use a pathfinding algorithm like A-star or Dijkstra's, which finds the shortest path from point A to point B while avoiding blocked cells.
- Explain A-star's key idea at a high level: it combines the actual distance traveled so far with an estimated distance remaining to prioritize which paths to explore first.
- Address real-world complications: the robot needs live sensor input to detect unexpected obstacles not on the original map, and must recompute the path dynamically.
- Mention practical constraints, like a minimum turning radius or the robot's physical size, which a simple grid model would need to account for to avoid unrealistic paths.
What a strong answer includes
- Names a specific, correct algorithm, A-star or Dijkstra's, rather than a vague find-the-shortest-path answer.
- Explains the algorithm's core intuition simply and correctly, rather than describing it as a black box.
- Addresses real-world dynamic obstacle handling, showing awareness this isn't just a static academic problem.
Common mistakes
- Describing the problem only in vague terms without naming any real pathfinding algorithm.
- Ignoring dynamic, real-world obstacles and treating the room as a static, fully known map.
Likely follow-up questions
- How would you handle a moving obstacle, like a person walking through the room?
- How would you balance path optimality against computation speed on limited robot hardware?
More ai & technical questions
- Create an API design for third-party integration for payments.Microsoft · AI & Technical · Hard
- How will you design a web service that enables other developers to create online chat applications?Microsoft · AI & Technical · Hard
- How will you design a mobile version of MS Word and ensure real time collaboration within this app?Microsoft · AI & Technical · Hard
- Design the security for a chat/messaging application.Microsoft · AI & Technical · Hard
- Design a system that can detect fraudulent use of Microsoft Word.Microsoft · AI & Technical · Hard
- Explain the architecture of your current or past product in detail.Flexport · AI & Technical · Easy
More questions from Microsoft
Learn the skill behind it
Chapters of the AI PM course that teach what this question tests.
- Chapter 1: Foundations: the model and the decisions it forces on you
- Chapter 8: Evals: define good and make the number defensible
- Chapter 6: Agents and agentic architecture