Shortest distance from all buildings

0
Remix

A grid has empty land, buildings and obstacles. Find the empty cell whose total walking distance to every building is smallest (moving up, down, left or right), or return -1 if no empty cell reaches all buildings.

MetaWaymoCodingLast asked Aug 2026
No answer yet. Write the first one; the best answer gets endorsed.