Pregunta de entrevista de Sierra

A coding question focused on problem solving and algorithms.