Cracker Barrel interview question

A challenge I had overcome