Metaseniordez. de 2025
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tree.
Count how many nodes in a binary tree are "good", meaning their value is at least the maximum value seen on the path from the root to that node. This is solved by a tree traversal (DFS/BFS) that carries the current path maximum and increments the count when a node's value >= that maximum; n up to 10^5.
Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tree.
Nenhum anexo público associado a esta pergunta.
No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.