[C++] Beats 97% | LIS | Just ignore K for a while :)
We can skip K for a while, which makes this question as Minimum operations to Make the Array Increasing, which can be solved by finding the LIS (Longest Increas
We can skip `K` for a while, which makes this question as `Minimum operations to Make the Array Increasing`, which can be solved by finding the LIS (Longest Increasing Subsequence), using binary search, and subtracting the size of LIS from size of the array. Performing this step `K` times will give the desired result.\n\n```\n/* \n    Time: O(nlogn)\n    Space: O(n)\n    Tag: DP and Binary Seach (LIS)\n    Difficulty: H\n*/\n\nclass Solution {\npublic:\n    int kIncreasing(vector<int> &arr, int k) {\n        int res = 0;\n        vector<int> lis;\n\n        for (int i = 0; i < k; i++) {\n            int size = 0;\n            for (int j = i; j < arr.size(); j += k) {\n                size++;\n                auto it = upper_bound(lis.begin(), lis.end(), arr[j]);\n                if (it == lis.end())\n                    lis.push_back(arr[j]);\n                else\n                    *it = arr[j];\n            }\n            res += size - lis.size();\n            lis.clear();\n        }\n        return res;\n    }\n};\n```
['Dynamic Programming', 'C', 'Binary Tree', 'C++']