[LeetCode] Delete and Earn

1 · · May 16, 2021, 6:32 a.m.
740. Delete and Earn Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element equal to nums[i] - 1 or nums[i] + 1. You start with 0 points. Return the maximum number of points you can earn by applying such operations. ...