Search
⌘K
Get Premium
Leetcode 740. Delete and Earn
Aggregate points for each distinct number (value * frequency), then choose a subset of values maximizing sum with the constraint that taking value x forbids taking x-1 and x+1. This is equivalent to selecting non-adjacent keys (like House Robber) and solved with dynamic programming over the value range.
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.