✅ [c++]  ||  Longest Increasing Subsequence
\nclass Solution {\npublic:\n    int LIS(vector<int>& vec){\n        int n=vec.size();\n        \n        vector<int> lis; //keep track of all the element which
```\nclass Solution {\npublic:\n    int LIS(vector<int>& vec){\n        int n=vec.size();\n        \n        vector<int> lis; //keep track of all the element which takes part in LIS\n        lis.push_back(vec[0]);\n        \n        for(int i=1; i<n; ++i){\n            if(vec[i] >= lis.back()) lis.push_back(vec[i]);\n            else{\n                auto lb = upper_bound(lis.begin(), lis.end(), vec[i]);\n                int idx = lb-lis.begin();\n                swap(lis[idx], vec[i]);\n            }\n        }\n        return n-lis.size(); //not part of LIS\n    }\n    \n    int kIncreasing(vector<int>& arr, int k) {\n        int n=arr.size();\n        int count = 0;\n        for(int i=0; i<k; ++i){\n            vector<int> vec;\n            for(int j=i; j<n; j=j+k){\n                vec.push_back(arr[j]);\n            }\n            count += LIS(vec);\n        }\n        return count;\n    }\n};\n```\nPlease **UPVOTE**
['C', 'C++']