Given the root of a binary tree and an integer distance, return the total number of good leaf node pairs in the tree.
A pair of distinct leaf nodes is considered good if the length of the shortest path connecting them is less than or equal to distance.
Constraints:
The number of nodes in the tree is in the range
Node.val
distance
Given the root of a binary tree and an integer distance, return the total number of good leaf node pairs in the tree.
A pair of distinct leaf nodes is considered good if the length of the shortest path connecting them is less than or equal to distance.
Constraints:
The number of nodes in the tree is in the range
Node.val
distance