2111. Minimum Operations to Make the Array K-Increasing.cpp
Code\n\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& arr, int k) {\n        \n        auto fn = [](vector<int>& sub) {\n            vector<int> v
**Code**\n```\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& arr, int k) {\n        \n        auto fn = [](vector<int>& sub) {\n            vector<int> vals; \n            for (auto& x : sub) {\n                auto it = upper_bound(vals.begin(), vals.end(), x); \n                if (it == vals.end()) vals.push_back(x); \n                else *it = x; \n            }\n            return sub.size() - vals.size(); \n        }; \n        \n        int ans = 0; \n        for (int i = 0; i < k; ++i) {\n            vector<int> sub; \n            for (int ii = i; ii < arr.size(); ii += k) \n                sub.push_back(arr[ii]); \n            ans += fn(sub); \n        }\n        return ans; \n    }\n};\n```
['C']