A simple programming problem I solved for a company interview.