Sharing my DP solution
If you are going to calculate max in both array simultaneously, it is going to be order of  (mnk) where m = arr1.length, n=arr2.length;\nIdea is calculate max i
If you are going to calculate max in both array simultaneously, it is going to be order of  (m*n*k) where m = arr1.length, n=arr2.length;\nIdea is calculate max in first array (m*k), calculate max in second array(n*k), then merge both max array to get final answer. complexity would be (m+n+k)*k;\n\n```\n// get max of two string\n    private String max(String s1, String s2) {\n        return (s1.compareTo(s2) < 0) ? s2 : s1;\n    }\n    \n    // calculate max in one array\n    public String[] helper1(int[] A, int k) {\n        int m = A.length;\n        String[][] dp = new String[m+1][k+1];\n        for (int i = 0; i <= m; i++) {\n            for (int l = 0; l <= k; l++) {\n                String chooseAi = (i == 0 || l == 0) ? "" : dp[i - 1][l - 1] + A[i - 1];\n                String ignoreAi = (i == 0) ? "" : dp[i - 1][l];\n                dp[i][l] = max(chooseAi, ignoreAi);\n            }\n        }\n        return dp[m];\n    }\n\n    \n    public int[] maxNumber(int[] nums1, int[] nums2, int k) {\n\n        String[] max1= helper1(nums1, Math.min(nums1.length,k));  // calculate max for num1\n        String[] max2= helper1(nums2, Math.min(nums2.length,k)); // calculate max for num2\n        \n        // merge two max array \n        String ans = "";\n        for(int t=0;t<=k;t++) { // k*k*k\n            int len1 = Math.min(nums1.length, t);\n            int len2 = Math.min(nums2.length, k-t);\n            if(len1+len2 != k) continue;\n            String ans1 = max1[len1];\n            String ans2 = max2[len2];\n            StringBuilder tmp = new StringBuilder();\n            while (tmp.length() < k) {\n                char ch;\n                if(ans1.compareTo(ans2)>=0){\n                    ch=ans1.charAt(0);\n                    ans1=ans1.substring(1);\n                }\n                else {\n                    ch=ans2.charAt(0);\n                    ans2=ans2.substring(1);\n                }\n                tmp.append(ch);\n            }\n            ans=max(ans,tmp.toString());\n\n        }\n\n        int[] tmp = new int[ans.length()];\n        for(int i=0;i<tmp.length;i++){\n            tmp[i]=ans.charAt(i)-\'0\';\n        }\n        return tmp;\n    }\n```\n
['Dynamic Programming']