[Python3] almost LIS
Please check out this commit for solutions of weekly 272. \n\n\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        \n        de
Please check out this [commit](https://github.com/gaosanyong/leetcode/commit/55c6a88797eef9ac745a3dbbff821a2aac735a70) for solutions of weekly 272. \n\n```\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        \n        def fn(sub): \n            """Return ops to make sub non-decreasing."""\n            vals = []\n            for x in sub: \n                k = bisect_right(vals, x)\n                if k == len(vals): vals.append(x)\n                else: vals[k] = x\n            return len(sub) - len(vals)\n        \n        return sum(fn(arr[i:len(arr):k]) for i in range(k))\n```\n\nAlternative implementation \n```\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        ans = 0 \n        for _ in range(k): \n            vals = []\n            for i in range(_, len(arr), k): \n                if not vals or vals[-1] <= arr[i]: vals.append(arr[i])\n                else: vals[bisect_right(vals, arr[i])] = arr[i]\n            ans += len(vals)\n        return len(arr) - ans\n```
['Python3']