C++ || LIS || easy to understand.
Intuition\n Describe your first thoughts on how to solve this problem. \nLIS DP\n\n# Approach\n Describe your approach to solving the problem. \nu all know abou
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nLIS DP\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nu all know about how to solve LIS using binary search then it will be simple for u to understand.\n\njust forget about k : problem is broken down in to samller problem : what is the min no of operation needed to make array increasing : is it ( n - size(lis));  ? bcoz this is same when k == 1;\n \nbasically here k != 1, we have to check for k array here.\nif k = 2;\nthen these two array will be:\n[a[0],a[2],a[4],a[6].....]\n[a[1],a[3],s[5],a[7].....]\n\nfor k == 3\nthese three array will be:\n[a[0],a[3],a[6],a[9].....] min ope needed is x.\n[a[1],a[4],s[7],a[10].....] min ope needed is y.\n[a[2],a[5],a[8],a[11].....] min ope needed is z.\n\nans = x + y + z;\n\n\nif it help then pls upvote.\n\n# Code\n```\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& arr, int k) {\n        vector<int>lis;\n        int res = 0;\n        for(int i=0;i<k;i++){\n            int sz = 0;\n            for(int j = i;j<arr.size();j+=k){\n                sz++;\n                auto it = upper_bound(lis.begin(),lis.end(),arr[j])-lis.begin();\n                if(it == lis.size())lis.push_back(arr[j]);\n                else lis[it] = arr[j];\n            }\n            res += sz - lis.size();\n            lis.clear();\n        }\n        return res;\n    }\n};\n\n\n```
['C++']