Algorithms | Monks in a Monastery

Last week I tackled another brain teaser. Loosely based on the Blue-Eyed Island brain teaser, this one uses monks in a monastery.

A bunch of monks are living in a monastery, and a visitor comes to visit with a strange request: all monks with Xs on their foreheads must leave the monastery as soon as possible. Each monk can see the others’ forehead, but they do not know whether they have an X on their own forehead (nor is anyone allowed to tell them). Additionally, they do not know how many monks have an X on their forehead, although they do know that at least two people do. How many days will it take for the monks with Xs on their heads to leave?
— Cracking the Code, Chapter 6, page 123
Whiteboarding  

Whiteboarding  

Some more things