Pergunta de entrevista da empresa Verily

recursion / iteration, tree, design question