Maximum Number of K-Divisible Components - Leetcode 2872 - Python
NeetCodeIO · 18:51
NeetCode solves the hard problem "Maximum Number of K-Divisible Components" (LeetCode 2872) with one bottom-up DFS over the tree. Each subtree returns its sum, and every subtree whose sum is divisible by k adds one to...