Plan a Delivery Robot Route That Minimizes the Steepest Climb
Last updated: November 29, 2026
Quick Overview
A robot crosses a grid of floor heights from the top-left to the bottom-right cell, moving in four directions. The effort of a route is the largest absolute height difference between consecutive cells; return the minimum possible effort.
Meta
November 29, 20260
0
0 solved
A robot crosses a grid of floor heights from the top-left to the bottom-right cell, moving in four directions. The effort of a route is the largest absolute height difference between consecutive cells; return the minimum possible effort.
A typical Meta onsite coding question where the cost function is a bottleneck (max over edges) instead of a sum. Framed around a robot moving through a data center or Reality Labs warehouse floor. Interviewers look for the insight that Dijkstra still works when the path cost is a monotone max, and for clean grid neighbor handling.
What the Interviewer Expects
- Identify the minimax path structure
- Adapt Dijkstra so the path cost is max(previous, edge) instead of a sum
- Mention binary search plus BFS or union-find as alternatives and compare them
- Write clean bounds checks for four-directional moves
- Return 0 for a single-cell grid
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
- Solve it with binary search on the answer plus BFS and compare complexities.
- How would union-find over edges sorted by weight solve it?
- What changes if diagonal moves are allowed?
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
heightsof sizeR x C, up to 100 x 100, values up to 10^6. - Moves are up, down, left and right.
- Return the smallest achievable maximum step difference along any route....
High-Level Design
Treat each cell as a node with edges to its four neighbors, weighted by height difference. The route cost is the maximum edge on it. Because max(e, w) >= e, extending a route never lowers its cost, ...