Minimum-Time Route on a Factory Floor With Turn Costs
Last updated: November 29, 2026
Quick Overview
A robot moves on a grid of a factory floor where '#' is blocked and 's' marks slow zones near people. From a start cell and heading, it can step forward (cost 1, or 3 in a slow zone) or rotate 90 degrees in place (cost 2). Return the minimum total time to reach a goal cell and the path.
Figure AI
November 29, 20260
0
0 solved
A robot moves on a grid of a factory floor where '#' is blocked and 's' marks slow zones near people. From a start cell and heading, it can step forward (cost 1, or 3 in a slow zone) or rotate 90 degrees in place (cost 2). Return the minimum total time to reach a goal cell and the path.
Humanoids deployed in automotive plants and warehouses share floor space with people and fixtures, and turning in place costs real time and stability for a legged robot. In a Figure AI onsite, this checks whether you expand the state to include heading and pick Dijkstra over BFS once costs differ.
What the Interviewer Expects
- Recognizes that position alone is not a sufficient state
- Uses Dijkstra on (row, col, heading) because edge weights differ
- Handles stale heap entries correctly
- Reconstructs the path and collapses in-place turns
- Discusses A* with an admissible heuristic
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Add an admissible heuristic for A*. Is Manhattan distance still admissible with turn costs?
- Other robots occupy cells at known times. How do you plan in space-time?
- The goal is any cell adjacent to a tote with the robot facing it. How do you encode that?
- How would you replan cheaply when a cell becomes blocked mid-route?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Grid with free, blocked and slow cells. State is position plus one of four headings. Actions: forward into a non-blocked in-bounds cell (cost step_cost, or slow_cost for 's'), turn left or right (...
High-Level Design
With unequal costs BFS is wrong, so run Dijkstra on the expanded graph of R * C * 4 states. Each state has at most three outgoing edges. Record parents to rebuild the path, then collapse consecutive...