Pregunta de entrevista de New York Times

A simple coding exercise, sub-easy Leetcode difficulty