← Questions
Distance from every cell to the nearest taxi
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A grid marks the cells where taxis are parked. Return, for every cell, the distance to the nearest taxi (moving up, down, left or right). Use a multi-source BFS and say why it beats a search from each cell.
Follow-up: taxis come online and go offline over time. How would you keep nearest-taxi answers current without recomputing everything, and how would that become a lookup service?
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
