PMMockr

QuestionsTechnical PMTop-Interview

Lexicographic Grid Travel.

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

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.

Start a timed mock interview

Related Technical PM questions

All Technical PM questions · Product manager interview questions by skill area