✅✅Faster || Easy To Understand || C++ Code
Using Binary Search\n\n Time Complexity :- O(NlogN * K)\n\n Space Complexity :- O(N * K)\n\n\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& nums, 
* ***Using Binary Search***\n\n* ***Time Complexity :- O(NlogN * K)***\n\n* ***Space Complexity :- O(N * K)***\n\n```\nclass Solution {\npublic:\n    int kIncreasing(vector<int>& nums, int k) {\n        \n        int n = nums.size();\n        \n        // all the k subsets are independent of each other, so we can perform lis on each k subsets independently\n        \n        // min_count store minimum operations needed\n        \n        int min_count = 0;\n        \n        // perform lis on each k subsets\n        \n        for(int j = 0; j < k; j++)  // starting index of subset\n        {\n            // perform lis\n            \n            vector<int> lis;\n            \n            lis.push_back(nums[j]);\n            \n            // total_element count no of element in each subset\n            \n            int total_element = 1;\n            \n            for(int i = j + k; i < n; i += k)\n            {\n                if(nums[i] >= lis.back())    // push into lis\n                    lis.push_back(nums[i]);\n                \n                else  // find the correct index in lis for nums[i]\n                {\n                    int idx = upper_bound(lis.begin(), lis.end(), nums[i]) - lis.begin();\n                    \n                    lis[idx] = nums[i];\n                }\n                \n                total_element++;\n            }\n            \n            // update result\n    \n            min_count += total_element - lis.size();\n        }\n        \n        return min_count;\n    }\n};\n```
['Binary Search', 'C', 'Binary Tree']