c++ lis
class Solution {\npublic:\n\n    int lis(vectornums)\n    {\n        int n=nums.size();\n        vectordp(n+1,INT_MAX);\n        dp[0]=INT_MIN;\n        for(int
class Solution {\npublic:\n\n    int lis(vector<int>nums)\n    {\n        int n=nums.size();\n        vector<int>dp(n+1,INT_MAX);\n        dp[0]=INT_MIN;\n        for(int i=0;i<n;i++)\n        {\n            int idx=upper_bound(dp.begin(),dp.end(),nums[i])-dp.begin();\n            if(dp[idx]>nums[i]&&dp[idx-1]<=nums[i])\n            {\n                dp[idx]=nums[i];\n            }\n        }\n        int res=0;\n        for(int i=n;i>=0;i--)\n        {\n            if(dp[i]!=INT_MAX)\n            {\n                res=i;\n                break;\n            }\n        }\n        return res;\n    }\n    int kIncreasing(vector<int>& arr, int k) {\n        int ans=0;\n        for(int i=0;i<k;i++)\n        {\n            vector<int>nums;\n            for(int j=i;j<arr.size();j+=k)\n            {\n                nums.push_back(arr[j]);\n            }\n            ans+=nums.size()-lis(nums);\n        \n            \n        }\n        return ans;\n    }\n    \n};
['C']