Questions › Technical PM › Top-Interview
Lexicographic Grid Travel.
- Technical PM
- Top-Interview
- Hard
- 45 min
Lexicographic Grid Travel.
Additional context: You are given an m × n grid with a start cell S and a destination cell D. Each cell contains a value from {0,1,2,3,4}, where 0 is blocked, and 1–4 correspond to bicycle, motorbike, car, and bus, respectively. You are also given matrices T and C representing the time and cost to enter each cell. You must choose exactly one mode of transport for the entire trip (no switching) and can move up, down, left, or right to adjacent cells compatible with your mode. Your goal is to find a path from S to D that minimizes (total_time, total_cost) lexicographically—that is, prefer smaller time, and among paths with equal time, smaller cost. Return the minimal (time, cost) across all modes, or -1 if the destination is unreachable.
What this question tests
- Technical PM
- Structured problem solving
- Communication
- Trade-off reasoning
Practise this question under interview conditions. Answer it out loud against a timer with an AI interviewer that asks follow-ups, then review the scored report.
Related Technical PM questions
- Given a bookstore database schema, write SQL queries using joins and aggregations to answer questions about sales, inventory, and customer data.Top-Interview · Technical PM · Easy
- Design a database schema for a fitness app.Top-Interview · Technical PM · Easy
- Design and implement a ranked cache system.Top-Interview · Technical PM · Easy
- Given a list of items with different sizes, write an algorithm to pack these items into the minimum number of batches without exceeding the capacity of each batch.Top-Interview · Technical PM · Easy
- What is SQL?Top-Interview · Technical PM · Easy
- Design a denoising system for sounds.Top-Interview · Technical PM · Easy
All Technical PM questions · Product manager interview questions by skill area