Samsung Electronics Interview Question

To write an algorithm that escapes a maze.