[Java] Simple Code - DP
dp[i][j][k] is denoted as the maximum string that takes a numbers from first i numbers from A, and b numbers from first j numbers from B to create a+b = k numbe
`dp[i][j][k]` is denoted as the maximum string that takes `a` numbers from first `i` numbers from `A`, and `b` numbers from first `j` numbers from `B` to create `a+b = k` numbers.\n\nedge case:\nif `(i+j < k)` then `dp[i][j][k] = empty`\nif `i = 0` or `j = 0`, the issue turns into `1 array`\nif `k = 0` then `dp[i][j][0] = empty`\n\n```\n    public int[] maxNumber(int[] A, int[] B, int k) {\n        int m = A.length, n = B.length;\n        if (m+n < k) return new int[0];\n\n        String[][][] dp = new String[m+1][n+1][k+1];\n        for (int i = 0; i <= m; i++) {\n            for (int j = 0; j <= n; j++) {\n                for (int l = 0; l <= k; l++) {\n                    if (i+j < l) dp[i][j][l] = "";\n                    else {\n                        String chooseAi = (i == 0 || l == 0) ? "" : dp[i-1][j][l-1] + A[i-1];\n                        String chooseBj = (j == 0 || l == 0) ? "" : dp[i][j-1][l-1] + B[j-1];\n                        String maxChoose = max(chooseAi, chooseBj);\n\n                        String ignoreAi = (i == 0) ? "" : dp[i-1][j][l];\n                        String ignoreBj = (j == 0) ? "" : dp[i][j-1][l];\n                        String ignoreBoth = (i == 0 || j == 0) ? "" : dp[i-1][j-1][l];\n                        String maxIgnore = max(max(ignoreAi, ignoreBj), ignoreBoth);\n\n                        dp[i][j][l] = max(maxChoose, maxIgnore);\n                    }\n                }\n            }\n        }\n\n        return convert(dp[m][n][k]);\n    }\n\n    private String max(String s1, String s2) {\n        return (s1.compareTo(s2) < 0) ? s2 : s1;\n    }\n\n    private int[] convert(String s)  {\n        int n = s.length(), res[] = new int[n];\n        for (int i = 0; i < n; i++) {\n            res[i] = s.charAt(i)-\'0\';\n        }\n        return res;\n    }\n```\n\nTime complexity `O(mnk)`, Space complexity `O(mnk)`.\nthough `MLE`, but space complexity can be improved to `O(mn)` (good practice).
[]