FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2530,3 "name": "minimize-maximum-of-array",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/minimize-maximum-of-array/",6 "date": "2022-10-01",7 "task_description": "You are given a **0-indexed** array `nums` comprising of `n` non-negative integers. In one operation, you must: Choose an integer `i` such that `1 <= i < n` and `nums[i] > 0`. Decrease `nums[i]` by 1. Increase `nums[i - 1]` by 1. Return_ the **minimum** possible value of the **maximum** integer of _`nums`_ after performing **any** number of operations_. **Example 1:** ``` **Input:** nums = [3,7,1,6] **Output:** 5 **Explanation:** One set of optimal operations is as follows: 1. Choose i = 1, and nums becomes [4,6,1,6]. 2. Choose i = 3, and nums becomes [4,6,2,5]. 3. Choose i = 1, and nums becomes [5,5,2,5]. The maximum integer of nums is 5. It can be shown that the maximum number cannot be less than 5. Therefore, we return 5. ``` **Example 2:** ``` **Input:** nums = [10,1] **Output:** 10 **Explanation:** It is optimal to leave nums as is, and since 10 is the maximum value, we return 10. ``` **Constraints:** `n == nums.length` `2 <= n <= 105` `0 <= nums[i] <= 109`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [3,7,1,6]",12 "output": "5 "13 },14 {15 "label": "Example 2",16 "input": "nums = [10,1]",17 "output": "10 "18 }19 ],20 "constraints": [21 "Choose an integer i such that 1 <= i < n and nums[i] > 0.",22 "Decrease nums[i] by 1.",23 "Increase nums[i - 1] by 1.",24 "n == nums.length",25 "2 <= n <= 105",26 "0 <= nums[i] <= 109"27 ],28 "python_template": "class Solution(object):\n def minimizeArrayValue(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ",29 "java_template": "class Solution {\n public int minimizeArrayValue(int[] nums) {\n \n }\n}",30 "metadata": {31 "func_name": "minimizeArrayValue"32 }33}