<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. In one operation you can replace any element of the array with <strong>any two</strong> elements that <strong>sum</strong> to it.</p>

<ul>
	<li>For example, consider <code>nums = [5,6,7]</code>. In one operation, we can replace <code>nums[1]</code> with <code>2</code> and <code>4</code> and convert <code>nums</code> to <code>[5,2,4,7]</code>.</li>
</ul>

<p>Return <em>the minimum number of operations to make an array that is sorted in <strong>non-decreasing</strong> order</em>.</p>

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

<pre>
<strong>Input:</strong> nums = [3,9,3]
<strong>Output:</strong> 2
<strong>Explanation:</strong> Here are the steps to sort the array in non-decreasing order:
- From [3,9,3], replace the 9 with 3 and 6 so the array becomes [3,3,6,3]
- From [3,3,6,3], replace the 6 with 3 and 3 so the array becomes [3,3,3,3,3]
There are 2 steps to sort the array in non-decreasing order. Therefore, we return 2.

</pre>

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

<pre>
<strong>Input:</strong> nums = [1,2,3,4,5]
<strong>Output:</strong> 0
<strong>Explanation:</strong> The array is already in non-decreasing order. Therefore, we return 0. 
</pre>

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

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

class Solution:
    def minimumReplacement(self, nums: List[int]) -> int:
        
        n = len(nums)
        last = nums[n - 1]  # Initialize 'last' with the last element
        ans = 0  # Initialize the total operations count

        # Traverse the array in reverse order
        for i in range(n - 2, -1, -1):
            if nums[i] > last:  # If the current element needs replacement
                t = nums[i] // last  # Calculate how many times the element needs to be divided
                if nums[i] % last:
                    t += 1  # If there's a remainder, increment 't'
                """This Part is Tricky --> cosider 10 4 -> 3 4 4 
                The idea is how much max u can consider """
                last = nums[i] // t  # Update 'last' for the next comparison
                ans += t - 1  # Add (t - 1) to 'ans' for the number of operations
            else:
                last = nums[i]  # Update 'last' without replacement
        return ans  # Return the total number of operations

        """prev = nums[i]/parts explanation :

        At this step we are clear that how many parts we want.
        We want to keep first val of our parts to be max as we 
        can then take this as prev value and look for parts in 
        next val to compare, which wil result in lesser parts if
        prev was maximum possible.
        So best greedy max first value of the parts will be nums[i]/parts,
        remainder can be added from back so that non decreasing property 
        can be maintained."""
408