Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2421. Number of Good Paths
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.