Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
minimum-score-by-changing-two-elements.json38 linesDownload Raw Back to root
1{2  "id": 2706,3  "name": "minimum-score-by-changing-two-elements",4  "difficulty": "Medium",5  "link": "https://leetcode.com/problems/minimum-score-by-changing-two-elements/",6  "date": "2023-02-04",7  "task_description": "You are given an integer array `nums`. The **low** score of `nums` is the **minimum** absolute difference between any two integers. The **high** score of `nums` is the **maximum** absolute difference between any two integers. The **score** of `nums` is the sum of the **high** and **low** scores. Return the **minimum score** after **changing two elements** of `nums`. **Example 1:** **Input:** nums = [1,4,7,8,5] **Output:** 3 **Explanation:** Change `nums[0]` and `nums[1]` to be 6 so that `nums` becomes [6,6,7,8,5]. The low score is the minimum absolute difference: |6 - 6| = 0. The high score is the maximum absolute difference: |8 - 5| = 3. The sum of high and low score is 3. **Example 2:** **Input:** nums = [1,4,3] **Output:** 0 **Explanation:** Change `nums[1]` and `nums[2]` to 1 so that `nums` becomes [1,1,1]. The sum of maximum absolute difference and minimum absolute difference is 0. **Constraints:** `3 <= nums.length <= 105` `1 <= nums[i] <= 109`",8  "test_case": [9    {10      "label": "Example 1",11      "input": "nums = [1,4,7,8,5]",12      "output": "3 "13    },14    {15      "label": "Example 2",16      "input": "nums = [1,4,3]",17      "output": "0 "18    }19  ],20  "constraints": [21    "The low score of nums is the minimum absolute difference between any two integers.",22    "The high score of nums is the maximum absolute difference between any two integers.",23    "The score of nums is the sum of the high and low scores.",24    "Change nums[0] and nums[1] to be 6 so that nums becomes [6,6,7,8,5].",25    "The low score is the minimum absolute difference: |6 - 6| = 0.",26    "The high score is the maximum absolute difference: |8 - 5| = 3.",27    "The sum of high and low score is 3.",28    "Change nums[1] and nums[2] to 1 so that nums becomes [1,1,1].",29    "The sum of maximum absolute difference and minimum absolute difference is 0.",30    "3 <= nums.length <= 105",31    "1 <= nums[i] <= 109"32  ],33  "python_template": "class Solution(object):\n    def minimizeSum(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        ",34  "java_template": "class Solution {\n    public int minimizeSum(int[] nums) {\n        \n    }\n}",35  "metadata": {36    "func_name": "minimizeSum"37  }38}