Search
⌘K

Leetcode 1530. Number of Good Leaf Nodes Pairs

Count how many pairs of distinct leaf nodes in a binary tree have a shortest-path length less than or equal to a given distance. The challenge is to efficiently aggregate leaf-to-node distance information during a tree traversal (distance ≤ 10 bounds how far counts must be propagated) so you can count qualifying pairs without checking all leaf pairs.

Asked at:

LinkedIn

LinkedIn


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late February, 2025

LinkedIn

LinkedIn

Mid-level

Comments

Your account is free and you can post anonymously if you choose.