← Questions

Fastest single-mode commute on a city grid

0
DatabricksCodingLast asked Oct 2026

A coding interview question asked in Databricks's algorithms (two rounds) round, last asked Oct 2026. It tests bfs, grid and shortest path.

You are planning a commute across a city drawn as a 2D grid of characters: You are also given two arrays of length k. time[i-1] and cost[i-1] are the minutes and dollars that mode i spends per block. You pick one mode for the whole trip…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

What it tests

bfs · grid · shortest path

Your code and the AI tutor open when you unlock this question.