#3186

Maximum Total Damage With Spell Casting

specialist · 945 · lc medium +32 · 45.1% accepted · 750 likes · top 28%

Description

Given a power array of spell damage values (duplicates allowed), casting a spell of damage d prevents casting any spell with damage d-2, d-1, d+1, or d+2. Each spell is cast at most once. Return the maximum total damage.

Code

1
2
3