Clean and easy to understand C++ solution
vector<int> maxVector(vector<int> nums, int k) {\n        while (nums.size() > k) {\n            int i = 0, n = nums.size();\n            for (; i < n - 1; ++i)
    vector<int> maxVector(vector<int> nums, int k) {\n        while (nums.size() > k) {\n            int i = 0, n = nums.size();\n            for (; i < n - 1; ++i) {\n                if (nums[i] < nums[i + 1]) {\n                    nums.erase(nums.begin() + i);\n                    break;\n                }\n            }\n            if (i == n - 1) nums.erase(nums.begin() + i);\n        }\n    \n        return nums;\n    }\n    \n    bool compare(vector<int> &nums1, int i, vector<int> &nums2, int j) {\n        while (i < nums1.size() && j < nums2.size() && nums1[i] == nums2[j]) {\n            ++i;\n            ++j;\n        }\n        if (j == nums2.size()) return true;\n        if (i < nums1.size() && nums1[i] > nums2[j]) return true;\n        return false;\n    }\n    \n    vector<int> merge(vector<int> &nums1, vector<int> &nums2, int k) {\n        vector<int> res(k, 0);\n        for (int i = 0, j = 0, r = 0; r < k; ++r) {\n            res[r] = compare(nums1, i, nums2, j) ? nums1[i++] : nums2[j++];\n        }\n    \n        return res;\n    }\n    \n    vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {\n        int m = nums1.size(), n = nums2.size();\n        vector<int> res(k, 0);\n    \n        for (int i = max(0, k - n); i <= min(k, m); ++i) {\n            auto v1 = maxVector(nums1, i);\n            auto v2 = maxVector(nums2, k - i);\n            auto tmp = merge(v1, v2, k);\n            if (compare(tmp, 0, res, 0)) res = tmp;\n        }\n    \n        return res;\n    }
['C++']