<p>You are given a <strong>0-indexed</strong> array <code>nums</code> comprising of <code>n</code> non-negative integers.</p>

<p>In one operation, you must:</p>

<ul>
	<li>Choose an integer <code>i</code> such that <code>1 &lt;= i &lt; n</code> and <code>nums[i] &gt; 0</code>.</li>
	<li>Decrease <code>nums[i]</code> by 1.</li>
	<li>Increase <code>nums[i - 1]</code> by 1.</li>
</ul>

<p>Return<em> the <strong>minimum</strong> possible value of the <strong>maximum</strong> integer of </em><code>nums</code><em> after performing <strong>any</strong> number of operations</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> nums = [3,7,1,6]
<strong>Output:</strong> 5
<strong>Explanation:</strong>
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.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> nums = [10,1]
<strong>Output:</strong> 10
<strong>Explanation:</strong>
It is optimal to leave nums as is, and since 10 is the maximum value, we return 10.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>n == nums.length</code></li>
	<li><code>2 &lt;= n &lt;= 10<sup>5</sup></code></li>
	<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
</ul>

class Solution:
    """
    We have 0 indexed array nums made of n numbers

    integer index i
        - [1, n)
        - nums[i] > 0 (can't be 0)

    What is the smallest max we can get after performing the
    operation as many times as we want

    Examples:

    [3, 7, 1, 6] cur_max = 7
    [4, 6, 1, 6] cur_max = 6
    [5, 5, 1, 6] cur_max = 6
    [5, 5, 2, 5] cur_max = 5
    [5, 5, 3, 4] cur_max = 5 The current max increased thus we stop
    [6, 4, 3, 4] cur_max = 6

    [10, 1] cur_max = 10
    [11, 0] cur_max = 11 current max increased thus we have to stop

    [3, 10, 10, 12, 5, 8] cur_max = 11
    [3, 10, 11, 11, 5, 8] cur_max = 11

    we want to choose maximium value who decreases the max
    so we take a max and look at its neighbors if it is less than we can take 
    it?

    [3, 11, 10, 11, 5, 8] cur_max = 11
    [4, 10, 10, 11, 5, 8] cur_max = 11
    [4, 10, 11, 10, 5, 8]
    [4, 11, 10, 10, 5, 8]
    [5, 10, 10, 10, 5, 8]
    [6, 9, 10, 10, 5,  8]
    [6, 10,, 9, 10, 5, 8]
    [7, 9, 9, 10, 5, 8]
    """
    def minimizeArrayValue(self, nums: List[int]) -> int:
        
        res = 0
        sum_= 0
        r = 0
        while (r < len(nums)):
            sum_ += nums[r]
            res = max(math.ceil(sum_/(r + 1)), res)
            r += 1
        
        return int(res)
597