You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If no cell can reach all buildings, return -1; otherwise, return the minimum distance
return-1ifanswer==float('inf') elseanswer
# Time: O((m * n) * (m * n)) # where m is the number of rows and n is the number of columns in the grid. As there could be up to m * n buildings in the worst case.