Available question text
Given a rooted tree with a lowercase label on each node, return for every node how many nodes in its subtree have the same label; the core challenge is to aggregate label frequencies across subtrees (typically via a postorder DFS) to compute each count efficiently for n up to 1e5.
Related questions
Continue with questions that share topics or the same question type.
- Find Number of Coins to Place in Tree Nodes
Coding
- All Nodes Distance K in Binary Tree
Coding · Binary Tree · Breadth-First Search · Depth-First Search
- Binary Tree Nodes
Coding
- Closest Nodes Queries in a Binary Search Tree
Coding
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 1519. Number of Nodes in the Sub-Tree With the Same Label
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source