Banco público de perguntas reais para entrevistas: explore por empresa, categoria e tema
CodingMid-level

Leetcode 987. Vertical Order Traversal of a Binary Tree

Assign each node coordinates (row, col) with root at (0,0) and children at (r+1,c±1), then produce a list of columns from leftmost to rightmost where nodes in each column are ordered by increasing row and, for nodes with the same row and column, by increasing node value.

Empresas em que apareceu
MetaMeta
Contextos reais

Onde essa pergunta já apareceu

Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.

Metaseniornov. de 2025

Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree is at (0, 0). The vertical order traversal of a binary tree is a list of top-to-bottom orderings for each column index starting from the leftmost column and ending on the rightmost column. There may be multiple nodes in the same row and same column. In such a case, the node that appears in any of left subtrees is the first one in the vertical ordering. Return the vertical order traversal of the binary tree.

Anexos públicos

Materiais associados

Nenhum anexo público associado a esta pergunta.

Sinais de resposta forte
Você deixa claro por que escolheu essa abordagem e o que descartou.
Seu código vem acompanhado de testes mentais e edge cases relevantes.
Sua explicação ajuda o entrevistador a acompanhar o raciocínio em tempo real.
O que costuma enfraquecer a resposta
Entrar direto no código sem alinhar interpretação do problema.
Passar tempo demais em silêncio e só explicar no fim.
Ignorar complexidade, invariantes e estratégia de teste.

Continue a preparação com o banco completo

No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.