I got a bit of inspiration this week from Ali Spittel.
She has a regular habit of doing a code puzzle every day. Like the New York Times crossword, she starts with an easy one on Mondays and they get progressively harder over the course of the week. Every day she posts a link on Twitter to the puzzle she’s working on.
I found out about this just today, when she started posting them also to the dev.to developers site, and since it’s Saturday, I’m late to this week’s party.
But I figured, why not. So I started with the puzzle she posted on Monday. May as well start out at the shallow end of the pool.
And here’s my solution for PHP, the TDD way: