Minimize array maximum
Your task
You are given an array nums and an integer threshold. Repeatedly you may pick any index i (1 <= i < len(nums)) where nums[i] > 0, decrement nums[i] by 1 and increment nums[i-1] by 1. After any number of such operations, return the minimum possible value of the maximum element of the array. Constraints: 1 <= len(nums) <= 10^5, 0 <= nums[i] <= 10^9.
Examples
minimize_array_max(nums: list[int]) -> intExample 1
Input
minimize_array_max([3, 7, 1, 6])Output
5