Available question text
Partition a tree by removing edges so every resulting component's node-sum is divisible by k, and return the maximum number of components. The core challenge is a tree DP / DFS problem computing subtree sums modulo k to decide where cuts can be made (greedy cuts on subtrees whose sum ≡ 0 mod k).
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 2872. Maximum Number of K-Divisible Components
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source