Fastest Commute Mode Through a Grid
Asked at Databricks · Coding Questions · Difficulty: Medium · Last asked Jun 29, 2026
A city map is a rectangular grid. Every cell holds a one-letter code. `'S'` marks the start, `'D'` the destination, `'X'` a blocked cell, and any other letter is a transport mode (for example `'a'` for bus, `'b'` for bike). Each mode has a time and a cost for entering a cell of that mode. Find the route from `S` to `D` that takes the least total time and, among routes with equal total time, the least total cost.
Loading the problem…