A very efficient solution accepted as best beating 98% 16ms in C++, well-commented
class Solution {\n    public:\n        // create max number of length t from single non-empty vector\n        // @nums is the array of length @len \n        // 
    class Solution {\n    public:\n        // create max number of length t from single non-empty vector\n        // @nums is the array of length @len \n        // @result will be used to store the max number of length @t \n        // @sortedLen indicates the prefix length which is in descending order;\n        void getMax(int* nums, int& len, int* result, int& t, int& sortedLen)\n        {\n            int n, top = 0;\n            result[0] = nums[0];\n            const int need2drop = len - t;\n            for (int i = 1; i < len; ++i){\n                n = nums[i];\n                while (top >= 0 && result[top] < n && (i - top) <= need2drop) --top; // i - top means already dropped i - top numsbers\n                if (i - top > need2drop){\n                    sortedLen = max(1,top);\n                    while (++top < t) result[top] = nums[i++];\n                    return;\n                }\n                if (++top < t) result[top] = n;\n                else top = t - 1;\n            }\n        }\n        // create max number of different length from single vector\n        // @nums is the original array of length @len\n        // @sortedLen is the longest length of the descending prefix of the max number;\n        // @minL and @maxL is the min and max length of the result max number\n        // @res is a pointer which will record the max numbers of length ranging from minL to maxL\n        // @k is the length of the final max number;\n        void dp(int *nums, int len, int&sortedLen, int& minL, int& maxL, int *res, int &k)\n        {\n            int  j, *head, *preHead = res;\n            const int soi = sizeof(int);\n            getMax(nums, len, res, maxL, sortedLen);\n            for(int l = maxL; l > max(minL,1); --l) //according to the max number of length maxL to generate all the max numbers ranging from minL to maxL (exclusive) and append them;\n            {\n                head = preHead + k; //jump to the next max-number pointer;\n                memcpy(head, preHead, l*soi); \n                for(j = sortedLen; j < l; ++j)\n                {\n                    if(head[j] > head[j - 1]) //remove the previous element encountering the first ascending pair;\n                    {\n                        sortedLen = max(1, j - 1); //update the sortedLen;\n                        memcpy(head + j - 1, preHead + j, soi*(l - j));\n                        break;\n                    }\n                }\n                if(j == l) sortedLen = l; //it's already descending, remove the last element updating sortedLen to l;\n                preHead = head; //update preHead;\n            }\n        }\n        // merge max number created from single vector\n        // @nums1 is the first array of length @len1\n        // @nums2 is the second array of length @len2\n        // @result is the array of length @resSize which will contain the max number generated\n        // by the both two arrays without changing the order in each array;\n        void merge(int* nums1,int len1,int* nums2,int len2,int* result,int& resSize)\n        {\n            int i = 0, j = 0, k = 0; //i -> result, j -> nums1, k -> nums2;\n            while (i < resSize)\n            {\n                if (j < len1 && k < len2) //normal case;\n                {\n                    if (nums1[j] > nums2[k]) //collect the bigger element first;\n                        result[i++] = nums1[j++];\n                    else if (nums1[j] < nums2[k])\n                        result[i++] = nums2[k++];\n                    else //when they are equal, collect the one with bigger lexical order;\n                    {\n                        int remaining1 = len1-j, remaining2 = len2-k, tmp = nums1[j];\n                        int flag = memcmp(nums1+j, nums2+k, sizeof(int)*min(remaining1, remaining2));\n                        flag = (flag==0 ? (remaining1>remaining2 ? 1 : -1) : flag); //determine which is bigger in lexical order -> when the lexical order are the same the longer one will be bigger in order;\n                        int * nums = flag > 0 ? nums1 : nums2;\n                        int & cnt = flag > 0 ? j : k; //using reference to modify j or k;\n                        int len = flag > 0 ? len1 : len2;\n                        while (nums[cnt]==tmp && cnt < len && i<resSize) result[i++] = nums[cnt++];\n                    }\n                }\n                else if (j < len1) result[i++] = nums1[j++];\n                else result[i++] = nums2[k++];\n            }\n        }\n    \n        //AC - 16ms - the most efficient solution;\n        // Reference: https://leetcode.com/discuss/85603/c-16ms-fastest-beats-97%25\n        vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k){\n            int soi = sizeof(int), len1 = nums1.size(), len2 = nums2.size();\n            int step = k*soi; //the space the final max number might take in memory;\n            int minL1 = max(0, k-len2), maxL1 = min(k, len1), minL2 = k-maxL1, maxL2 = k-minL1, range = maxL1-minL1+1;\n            int * res = new int[range*k*2 + 2*k], *dp1 = res+k, *dp2 = res+range*k+k, *tmp=res+range*2*k+k; //using one-dimension array to handle different arrays -> only using the necessary space without any waste;\n            memset(res, 0, step);\n            int sortedLen1=1, sortedLen2=1;\n            if (len1 == 0 && len2 > 0) getMax(&nums2[0], len2, res, k, sortedLen2); //handle corner cases;\n            else if (len1 > 0 && len2 == 0) getMax(&nums1[0], len1, res, k, sortedLen1);\n            else if (len1 > 0 && len2 > 0) //the normal case;\n            {\n                dp(&nums1[0], len1, sortedLen1, minL1, maxL1, dp1,k);\n                dp(&nums2[0], len2, sortedLen2, minL2, maxL2, dp2,k);\n                if (sortedLen1+sortedLen2 > k) //special cases - needless to check each combination accelerating the process from 20ms to 16ms;\n                    merge(dp1 + k*(maxL1 - sortedLen1), sortedLen1, dp2 + k*(maxL2 - sortedLen2), sortedLen2, res, k);\n                else for(int i = minL1; i <= maxL1; ++i)\n                {\n                    merge(dp1+k*(maxL1-i), i, dp2+k*(maxL2-k+i), (k-i), tmp,k);\n                    if(memcmp(res, tmp, step) < 0) memcpy(res, tmp, step);\n                }\n            }\n            vector<int> resv(res, res + k);\n            delete[] res;\n            return resv;\n        }\n    };
['C++']