dp + greedy faster than 80% c++ 36ms
\nclass Solution {\npublic:\n    vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {\n        vector<int> ans;\n        const int m = nums1.s
```\nclass Solution {\npublic:\n    vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {\n        vector<int> ans;\n        const int m = nums1.size(), n = nums2.size();\n        \n        for (int i = 0; i <= k; i++) {\n            int j = k - i;  \n            if (i > m || j > n) continue;\n            ans = max(ans, maxNumber(maxNumber(nums1,i),maxNumber(nums2,j)));\n        }\n        \n        return ans;\n    }\nprivate:\n    \n    vector<int> maxNumber(const vector<int>& nums, int k) {\n        if (k == 0) return {};\n        int to_pop = nums.size() - k;\n        vector<int> ans;\n        for (auto &num : nums) {\n            while (!ans.empty() && ans.back() < num && 0 < to_pop--)\n                 ans.pop_back();\n            ans.push_back(num);\n        }\n        ans.resize(k);\n        return ans;\n    }\n    \n     vector<int> maxNumber(const vector<int>& nums1,const vector<int>& nums2) {\n        vector<int> ans;\n        auto s1 = nums1.begin();\n        auto e1 = nums1.end();\n        auto s2 = nums2.begin();\n        auto e2 = nums2.end();\n        while (s1 != e1 || s2 != e2) {\n            ans.push_back(lexicographical_compare(s1,e1,s2,e2)?*s2++:*s1++);\n        }\n         return ans;\n     }\n    \n};\n```
[]