Got this question from one of the startups in SV.

At first, I thought it is like Number-of-Islands/Maze-Walking type of DFS, but I found that it is difficult to do it because it has more than 1 Point of Interests

Find the campsite

Given a NxN Square Matrix, find the best campsite by having the closest in distance to all the
POIs (Point of Interest) locations, while avoiding all the obstacles.

Returns the campsite location by coordinates in [x, y].

'*' :  Point of Interest
'X' :  Obstacle
'C' :  Possible campsite with the shortest distance to all the POIs

For example, C denotes the camp site location. Return that location's coordinates.

+-----------------------+
| * | X |   | * |   | * |
|   | X |   |   |   |   |
|   | X |   |   |   |   |
|   |   |   | C |   |   |
|   |   |   |   |   |   |
|   |   |   |   |   | * |
+-----------------------+
Comments (6)