<p>You are given a <strong>0-indexed</strong> array <code>arr</code> consisting of <code>n</code> positive integers, and a positive integer <code>k</code>.</p>
<p>The array <code>arr</code> is called <strong>K-increasing</strong> if <code>arr[i-k] <= arr[i]</code> holds for every index <code>i</code>, where <code>k <= i <= n-1</code>.</p>
<ul>
<li>For example, <code>arr = [4, 1, 5, 2, 6, 2]</code> is K-increasing for <code>k = 2</code> because:
<li>However, the same <code>arr</code> is not K-increasing for <code>k = 1</code> (because <code>arr[0] > arr[1]</code>) or <code>k = 3</code> (because <code>arr[0] > arr[3]</code>).</li>
</ul>
<p>In one <strong>operation</strong>, you can choose an index <code>i</code> and <strong>change</strong><code>arr[i]</code> into <strong>any</strong> positive integer.</p>
<p>Return <em>the <strong>minimum number of operations</strong> required to make the array K-increasing for the given </em><code>k</code>.</p>
</strong>For k = 1, the resultant array has to be non-decreasing.
Some of the K-increasing arrays that can be formed are [5,<u><strong>6</strong></u>,<u><strong>7</strong></u>,<u><strong>8</strong></u>,<u><strong>9</strong></u>], [<u><strong>1</strong></u>,<u><strong>1</strong></u>,<u><strong>1</strong></u>,<u><strong>1</strong></u>,1], [<u><strong>2</strong></u>,<u><strong>2</strong></u>,3,<u><strong>4</strong></u>,<u><strong>4</strong></u>]. All of them require 4 operations.
It is suboptimal to change the array to, for example, [<u><strong>6</strong></u>,<u><strong>7</strong></u>,<u><strong>8</strong></u>,<u><strong>9</strong></u>,<u><strong>10</strong></u>] because it would take 5 operations.
It can be shown that we cannot make the array K-increasing in less than 4 operations.