My answer to a cute problem I found online.