Search
⌘K

Leetcode 3562. Maximum Profit from Trading Stocks with Discounts

Given a rooted company tree with buy/sell prices for each employee, pick a subset of nodes to buy (each at most once) under a total budget to maximize total profit, where a node’s buy cost is present[v] or floor(present[v]/2) if its direct boss is also bought. Core challenge: a knapsack-style optimization on a tree where item costs/benefits depend on parent selection (tree DP + budgeted knapsack).


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.