Recursion

Recursing the Seven Dwarves

I recently stumbled onto “The Riddler” series from Five Thirty Eight. Each week, they present a puzzle to solve that involves math and probability, and since I don’t already have enough to do :grimmace:, I thought I’d give this week’s a shot: Where Will The Seven Dwarfs Sleep Tonight? Each of the seven dwarfs sleeps in his own bed in a shared dormitory. Every night, they retire to bed one at a time, always in the same sequential order, with the youngest dwarf retiring first and the oldest retiring last.