Search
⌘K
Get Premium
Leetcode 3186. Maximum Total Damage With Spell Casting
Given an array of spell damages, pick a subset to maximize total damage under the rule that choosing any value v forbids using values v-2, v-1, v+1, and v+2. Reduce by aggregating total damage per distinct value and solve with dynamic programming over the sorted values to handle the ±2 exclusion.
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.