Find shortest path in a grid with obstacles | Amazon Interview Question