Python from scratch
Python without any library: Complete implementation of bisect right\nTime Complexity - k * nlogn\nSpace - O(k)\n\n\nclass Solution:\n    def kIncreasing(self, a
Python without any library: Complete implementation of bisect right\nTime Complexity - k * nlogn\nSpace - O(k)\n\n```\nclass Solution:\n    def kIncreasing(self, arr: List[int], k: int) -> int:\n        \n        def LIS(nums):\n            res = []\n            for i in nums:\n                low,high = 0, len(res)\n                while low < high:\n                    mid = (low+high)//2\n                    \n                    if res[mid] <= i:\n                        low = mid + 1\n                        \n                    else:\n                        \n                        high = mid\n\n\n                if low == len(res):\n                    res.append(i)\n                else:\n\n                    res[low] = i\n                    \n                    \n\n\n            return len(res)\n        \n        ans = 0\n                \n        \n        for i in range(k):\n            bucket = []\n            startingIdx = i\n            while startingIdx < len(arr):\n                bucket.append(arr[startingIdx])\n                startingIdx += k\n                \n            \n                \n                \n            ans += len(bucket) - LIS(bucket)\n                \n                \n        return ans\n                ```
['Binary Tree', 'Python', 'Python3']