Challenge I solved as part of an interview.