Back to problems

Delete and Earn (LC 740)

Algorithm · Microsoft · Medium

Delete and Earn Medium · Topics · Company Tags · Hints You are given an integer array nums. In one move, you may pick any value v that still appears in the array, remove that occurrence, and add v points to your score. Additionally, you must remove every remaining copy of v - 1 and v + 1 from the array. You may repeat this move as many times as you wish, choosing any available element each time. Return the maximum total points you can collect. Example 1: Explanation: Take…

Checking your access…