Pergunta de entrevista da empresa athenahealth

Q: Leetcode medium difficulty, not too difficult