Python Hard
\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        N = len(arr)\n        lookup = defaultdict(list)\n        for i in range(k
```\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        N = len(arr)\n        lookup = defaultdict(list)\n        for i in range(k):\n            j = i\n            while j < N:\n                lookup[j % k].append(arr[j])\n                j += k\n\n        total = 0\n        for key in lookup.keys():\n            A = lookup[key]\n            if len(A) == 1:\n                continue\n\n            nums = [A[0]]\n            for x in A[1:]:\n                index = bisect_right(nums, x)\n\n                if index == len(nums):\n                    nums.append(x)\n\n                nums[index] = x\n\n            total += len(A) - len(nums)\n\n                \n\n        return total\n\n\n\n            \n\n            \n\n        \n        \n```
['Python3']