K grps LIS
\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& arr, int k) {\n        vector<vector<int> > lis(k);\n        int N=arr.size();\n        \n        
```\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& arr, int k) {\n        vector<vector<int> > lis(k);\n        int N=arr.size();\n        \n        for(int i=0;i<N;i++){\n            int grp = i%k;\n            grp_size[grp]++;\n            \n            auto &lis_grp = lis[grp];\n            \n            auto it = upper_bound(lis_grp.begin(),lis_grp.end(),arr[i]);\n            \n            if(it==lis_grp.end()) lis_grp.push_back(arr[i]);\n            else *it = arr[i];\n        }\n        \n        int ans=0;\n        for(int i=0;i<k;i++){\n            int grp_size = 1 + (N-i-1)/k;\n            ans += grp_size- lis[i].size();\n        }\n        return ans;\n    }\n};\n```
[]