Meta interview question

Matrix pathfinding and tree question