Available question text
Given an undirected tree and a set of directed parent guesses (each guess orients an existing edge u→v), count how many choices of root make at least k guesses true. The core challenge is to evaluate correctness for all possible roots efficiently (n, guesses ≤ 1e5) by computing the count for one root via DFS and then using a rerooting technique to update the count in O(1) per edge.
Related questions
Continue with questions that share topics or the same question type.
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 2581. Count Number of Possible Root Nodes
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source