Given an integer array nums, maximize the total points you can earn by repeatedly performing the following operation:
Choose an element nums[i] and delete it to earn nums[i] points. After deleting it, every element with value nums[i] - 1 or nums[i] + 1 must also be deleted, but these deleted elements earn no points.
Return the maximum number of points you can earn.
Constraints:
nums.length
nums[i]
Given an integer array nums, maximize the total points you can earn by repeatedly performing the following operation:
Choose an element nums[i] and delete it to earn nums[i] points. After deleting it, every element with value nums[i] - 1 or nums[i] + 1 must also be deleted, but these deleted elements earn no points.
Return the maximum number of points you can earn.
Constraints:
nums.length
nums[i]