Search
⌘K

Leetcode 2920. Maximum Points After Collecting Coins From All Nodes

Given a rooted tree with coin values, decide for each node whether to collect coins as coins[i]-k or as floor(coins[i]/2), where choosing the latter also halves every coin in its subtree (and multiple ancestor halvings stack), to maximize total points when all nodes must be collected. This requires a tree DP that tracks the propagated halving state along root-to-node paths (bounded by O(log(max coin))) to evaluate optimal choices.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.