Tap here to switch tabs
Problem
Submissions

Problem: Minimize Maximum of Array

med
30 min
Try to solve the Minimize Maximum of Array problem.

Statement

You are given a 00 indexed integer array nums containing n non negative integers.

In one operation, you may:

  • Select an integer i such that 1≤1 \leq i <n< n and nums[i] >0> 0.

  • Decrease nums[i] by 11.

  • Increase nums[i - 1] by 11.

Return the minimum possible value of the maximum integer in nums after applying any number of operations.

Constraints:

  • n ==== nums.length

  • 2≤2 \leq n ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimize Maximum of Array

med
30 min
Try to solve the Minimize Maximum of Array problem.

Statement

You are given a 00 indexed integer array nums containing n non negative integers.

In one operation, you may:

  • Select an integer i such that 1≤1 \leq i <n< n and nums[i] >0> 0.

  • Decrease nums[i] by 11.

  • Increase nums[i - 1] by 11.

Return the minimum possible value of the maximum integer in nums after applying any number of operations.

Constraints:

  • n ==== nums.length

  • 2≤2 \leq n ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9