2111. Minimum Operations to Make the Array K-Increasing
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
from bisect import bisect_right
from typing import List

class Solution:
    def longestNonDecreasingSubsequence(self, sequence):
        subsequence = []
        for value in sequence:
            if not subsequence or subsequence[-1] <= value:
                subsequence.append(value)
            else:
                position = bisect_right(subsequence, value)
                subsequence[position] = value
        return len(subsequence)

    def kIncreasing(self, arr: List[int], k: int) -> int:
        moves_needed = 0
        n = len(arr)
        for start in range(k):
            group = []
            for i in range(start, n, k):
                group.append(arr[i])
            moves_needed += len(group) - self.longestNonDecreasingSubsequence(group)
        return moves_needed

```
['Python3']