C++ time complexity O(k * (m+n)), 24ms
\nclass Solution {\n    void combine(std::vector<int> &res, std::vector<int> &v1, std::vector<int> &v2)\n    {\n        int len1 = v1.size();\n        int len2 
```\nclass Solution {\n    void combine(std::vector<int> &res, std::vector<int> &v1, std::vector<int> &v2)\n    {\n        int len1 = v1.size();\n        int len2 = v2.size();\n        int len = res.size();\n        int left = 0;\n        int right = 0;\n        for (int i = 0; i < len;) {\n            if (right == len2 || left != len1 && v1[left] > v2[right]) {\n                res[i++] = v1[left++];\n            } else if (left == len1 || v2[right] > v1[left]) {\n                res[i++] = v2[right++];\n            } else {\n                int ori_left = left;\n                int ori_right = right;\n                int tar = left;\n                int last_greater = right;\n                res[i++] = v1[left];\n                while (1) {\n                    ++left;\n                    ++right;\n                    if (left == len1 || right != len2 && v1[left] < v2[right]) {\n                        left = ori_left;\n                        break;\n                    } else if (right == len2 || v1[left] > v2[right]) {\n                        right = ori_right;\n                        break;\n                    }\n                    if (v1[left] < v1[tar]) {\n                        left = tar;\n                        right = last_greater + 1;\n                        break;\n                    } else if (v1[left] > v1[tar]) {\n                        last_greater = right;\n                        tar = ori_left;\n                    } else {\n                        ++tar;\n                    }\n                    res[i++] = v1[left];\n                }\n            }\n        }\n    }\n    void max_num(std::vector<int> &res, std::vector<int> &nums, int k)\n    {\n        res.clear();\n        int len = nums.size();\n        int diff = len - k;\n        for (int i = 0; i < len; ++i) {\n            while (res.size() > std::max(i - diff, 0) && nums[i] > res.back()) {\n                res.pop_back();\n            }\n            if (res.size() < k) {\n                res.push_back(nums[i]);\n            }\n        }\n    }\npublic:\n    vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {\n        std::vector<int> res(k);\n        std::vector<int> cur(k);\n        std::vector<int> temp1;\n        std::vector<int> temp2;\n        temp1.reserve(k);\n        temp2.reserve(k);\n        int len1 = nums1.size();\n        int len2 = nums2.size();\n        int max_len = std::min(len1, k);\n        int min_len = std::max(k - len2, 0);\n        for (int i = min_len; i <= max_len; ++i) {\n            max_num(temp1, nums1, i);\n            max_num(temp2, nums2, k - i);\n            combine(cur, temp1, temp2);\n            if (cur > res) {\n                res.swap(cur);\n            }\n        }\n        return res;\n    }\n};\n```
['Greedy', 'C']