Minimum Operations to Make the Array K-Increasing LeetCode solution in Python
1class Solution:2def kIncreasing(self, arr: List[int], k: int) -> int:3def LNDS(arr: List[int]) -> int:4mono = []5for n in arr:6if not mono or mono[-1] <= n:7mono.append(n)8else:9mono[bisect_right(mono, n)] = n10return len(mono)1112return len(arr) - sum(LNDS(arr[i::k]) for i in range(k))