Pregunta de entrevista de athenahealth

Q: Leetcode medium difficulty, not too difficult