Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2872. Maximum Number of K-Divisible Components
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).
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.