Available question text
Count the number of distinct simple paths in a tree whose endpoints have equal values and every intermediate node has value ≤ that endpoint value (single nodes count). The core challenge is to count pairs of equal-valued nodes that are connected without passing through larger values — typically handled by processing nodes/edges in nondecreasing value and maintaining connected components (e.g., with union-find) to tally combinations per value.
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 2421. Number of Good Paths
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source