TLE Python DP Solution O(k*m*n*m*n)
Short but TLE... :P\n\nPython Code:\n\n    class Solution(object):\n        def maxNumber(self, nums1, nums2, k):\n            len1 = len(nums1)\n            le
Short but TLE... :P\n\nPython Code:\n\n    class Solution(object):\n        def maxNumber(self, nums1, nums2, k):\n            len1 = len(nums1)\n            len2 = len(nums2)\n            dp = [[[[]] * (len2 + 1) for x in range(len1 + 1)] for y in range(k + 1)]\n            for z in range(1, k + 1):\n                for x in range(len1 + 1):\n                    for y in range(len2 + 1):\n                        for p in range(x):\n                            if len(dp[z-1][p][y]) == z - 1:\n                                dp[z][x][y] = max(dp[z][x][y], dp[z-1][p][y]+[nums1[p]])\n                        for q in range(y):\n                            if len(dp[z-1][x][q]) == z - 1:\n                                dp[z][x][y] = max(dp[z][x][y], dp[z-1][x][q]+[nums2[q]])\n            return dp[k][len1][len2]
['Dynamic Programming', 'Python']