FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 3788,3 "name": "maximum-unique-subarray-sum-after-deletion",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/maximum-unique-subarray-sum-after-deletion/",6 "date": "2025-03-09",7 "task_description": "You are given an integer array `nums`. You are allowed to delete any number of elements from `nums` without making it **empty**. After performing the deletions, select a subarray of `nums` such that: All elements in the subarray are **unique**. The sum of the elements in the subarray is **maximized**. Return the **maximum sum** of such a subarray. **Example 1:** **Input:** nums = [1,2,3,4,5] **Output:** 15 **Explanation:** Select the entire array without deleting any element to obtain the maximum sum. **Example 2:** **Input:** nums = [1,1,0,1,1] **Output:** 1 **Explanation:** Delete the element `nums[0] == 1`, `nums[1] == 1`, `nums[2] == 0`, and `nums[3] == 1`. Select the entire array `[1]` to obtain the maximum sum. **Example 3:** **Input:** nums = [1,2,-1,-2,1,0,-1] **Output:** 3 **Explanation:** Delete the elements `nums[2] == -1` and `nums[3] == -2`, and select the subarray `[2, 1]` from `[1, 2, 1, 0, -1]` to obtain the maximum sum. **Constraints:** `1 <= nums.length <= 100` `-100 <= nums[i] <= 100`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [1,2,3,4,5]",12 "output": "15 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,1,0,1,1]",17 "output": "1 "18 },19 {20 "label": "Example 3",21 "input": "nums = [1,2,-1,-2,1,0,-1]",22 "output": "3 "23 }24 ],25 "constraints": [26 "1 <= nums.length <= 100",27 "-100 <= nums[i] <= 100"28 ],29 "python_template": "class Solution(object):\n def maxSum(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ",30 "java_template": "class Solution {\n public int maxSum(int[] nums) {\n \n }\n}",31 "metadata": {32 "func_name": "maxSum"33 }34}