[C++] LIS with binary search
\nclass Solution {\npublic:\n    int upperBound(vector<int>& nums, int x) {\n        int left = 0;\n        int right = nums.size();\n        while (left < righ
```\nclass Solution {\npublic:\n    int upperBound(vector<int>& nums, int x) {\n        int left = 0;\n        int right = nums.size();\n        while (left < right) {\n            int mid = left + (right - left) / 2;\n            if (nums[mid] > x) right = mid;\n            else left = mid + 1;\n        }\n        return left;\n    }\n    int lis(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> dp;\n        for (auto num: nums) {\n            int index = upperBound(dp, num);\n            if (index == dp.size()) dp.push_back(num);\n            else dp[index] = num;\n        }\n        return n - dp.size();\n    }\n    int kIncreasing(vector<int>& arr, int k) {\n        vector<int> temp;\n        int res = 0;\n        for (int i = 0; i < k; i++) {\n            for (int j = i; j < arr.size(); j += k) {\n                temp.push_back(arr[j]);\n            }\n            res += lis(temp);\n            temp.clear();\n        }\n        return res;\n    }\n};\n```
['C', 'Binary Tree']