C++ | LIS | Beats 70.80%
\n# Code\n\nclass Solution {\npublic:\n    /* longest increasing subsequence */\n    int LIS(vector<int> &arr)\n    {\n        vector<int> lis(arr.size(), INT_M
\n# Code\n```\nclass Solution {\npublic:\n    /* longest increasing subsequence */\n    int LIS(vector<int> &arr)\n    {\n        vector<int> lis(arr.size(), INT_MAX);\n        int ans = 0;\n        for(int i = 0; i < arr.size(); i++)\n        {\n            int idx = upper_bound(lis.begin(), lis.end(), arr[i]) - lis.begin();\n            ans = max(idx + 1, ans);\n            lis[idx] = arr[i];\n        }\n        return arr.size() - ans;\n    }\n    /* * */\n    int kIncreasing(vector<int>& arr, int k)\n    {\n        vector<vector<int>> group(k);\n        for(int i = 0; i < k; i++)\n            for(int j = i; j < arr.size(); j+=k)\n                group[i].push_back(arr[j]);\n\n        int ans = 0;\n        for(auto &v : group)\n            ans += LIS(v);\n        return ans;\n    }\n};\n```
['C++']