Pergunta de entrevista da empresa Capital One

Binary tree question on leetcode