LIS concept
Code
# Code
```cpp []
class Solution {
public:
    int getAns(vector<int>& a) {
        vector<int> temp;
        int n = a.size();
        for (int i = 0; i < n; i++) {
            if (temp.size() == 0)
                temp.push_back(a[i]);
            else {
                int lb =
                    upper_bound(temp.begin(), temp.end(), a[i]) - temp.begin();
                if (lb == temp.size())
                    temp.push_back(a[i]);
                else
                    temp[lb] = a[i];
            }
        }
        return n - temp.size();
    }
    int kIncreasing(vector<int>& a, int k) {
        int n = a.size();
        vector<int> vis(n, 0);
        int i = 0;
        vector<vector<int>> p;
        for (int i = 0; i < k; i++) {
            if (vis[i] == 0) {
                vector<int> r;
                int j = i;
                while (j < n) {
                    r.push_back(a[j]);
                    vis[j] = 1;
                    j += k;
                }
                p.push_back(r);
            }
        }
        int ans = 0;
        for (auto i : p)
            ans += getAns(i);
        return ans;
    }
};
```
['C++']