Back to Question

Shortest Distance from All Buildings

Question Explain

You want to build a house on an empty land that is closest to all the buildings. Find the shortest total travel distance to all buildings. Use BFS starting from each building.

Start Trying This Question Simulation

Click "Start Speaking" and answer the question naturally.