using the concept of longest increasing subsequence
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int kIncreasing(vector<int>&nums, int k) {\n     int maxi=0;\n     for(int i=0;i<k;i++){\n         vector<int>res;\n         for(int j=i;j<nums.size();j+=k){\n             auto it=upper_bound(res.begin(),res.end(),nums[j]);\n             int k1=it-res.begin();\n             if(it==res.end()){\n                 res.push_back(nums[j]);\n             }\n             else{\n                 res[k1]=nums[j];\n             }\n         }\n         maxi+=res.size();\n     }\n     return nums.size()-maxi;\n    }\n};\n```
['C++']