Pergunta de entrevista da empresa Google

Write an algorithm that checks if a binary tree is balanced, improve it and determine its complexity.