Available question text
Given a rooted binary tree as a parent array, compute for each node the score defined as the product of sizes of the connected components that result when that node is removed (its child subtree sizes and the remaining complement), and return how many nodes achieve the maximum score. The core challenge is computing subtree sizes (e.g., with a DFS) and comparing the resulting products efficiently for up to 1e5 nodes.
Related questions
Continue with questions that share topics or the same question type.
- All Divisions With the Highest Score of a Binary Array
Coding
- Count Complete Tree Nodes
Coding
- Count Good Nodes in Binary Tree
Coding
- Count Nodes Equal to Average of Subtree
Coding · Binary Tree · Depth-First Search · Tree
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2049. Count Nodes With the Highest Score
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source