Compute shortest path with obstacles | Amazon Interview Question