Prison Break: A Simple Counting Problem

Imagine a prison having 36 cells arranged like the squares in a 6-by-6 grid. All adjacent cells have doors between them; doors that you can open. You, the prisoner in the top-left corner cell, are told that you can have your freedom if you can find your way to the diagonally opposite corner cell, after passing through each other cell exactly once.

An empty prison map


Can you figure such a way out of the prison?

If this seems to be taking you an embarrassingly long time, feel free to click here for the solution

 
6
Kudos
 
6
Kudos

Now read this

If Arundhati Roy wrote JavaScript

Angus Croll’s If Hemingway Wrote JavaScript is a beautifully illustrated book full of code snippets that are rich in their use of fundamental JavaScript abstractions and modern programming patterns. Born out of equal love for both... Continue →