<jupyter_start><jupyter_text>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.**Example 1:**    Input: nums = [3, 4, 2]    Output: 6    Explanation:     Delete 4 to earn 4 points, consequently 3 is also deleted.    Then, delete 2 to earn 2 points. 6 total points are earned.**Example 2:**    Input: nums = [2, 2, 3, 3, 3, 4]    Output: 9    Explanation:     Delete 3 to earn 3 points, deleting both 2's and the 4.    Then, delete 3 again to earn 3 points, and 3 again to earn 3 points.    9 total points are earned.    Note:>- The length of nums is at most 20000.- Each element nums[i] is an integer in the range [1, 10000].  ThoughtCombine with "House Rob"          Change the case [2,2,3,3,3,4]->[0, 2*2, 3*3, 4*1]=[0,4,9,4]     Ans then, utilize the house rob algorithm to find out how to get the most points.<jupyter_code>def deleteAndEarn(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        if not nums: return 0
        if len(nums)==1: return nums[0]
        
        dp=[0]*max(nums)
        
        for num in nums:
            dp[num-1]+=num
        
        
        a,b=0,0
        for i in dp:
            tmp,a=a,b+i
            #a=b+i
            b=max(tmp,b)
        
        return max(a,b)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10333761232349166, 'fraction_numerical': 0.04236200256739409, 'mean_word_length': 2.3240938166311302, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '533711', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 553, 'n_tokens_neox': 502, 'n_words': 211, 'path': '740. Delete and Earn.ipynb', 'repo_name': 'kkoo1122/Leetcode_Practice', 'size': '1558'}