Brute Force || pretty straight forward || less comments for explanation
\nclass Solution {\n    public int[] maxNumber(int[] a, int[] b, int k) {\n        int n = a.length;\n        int m = b.length;\n        \n        int x[][] = n
```\nclass Solution {\n    public int[] maxNumber(int[] a, int[] b, int k) {\n        int n = a.length;\n        int m = b.length;\n        \n        int x[][] = new int[n][];\n        int y[][] = new int[m][];\n        for(int i=0;i<n;i++)\n            x[i] = new int[i+1];\n        for(int i=0;i<m;i++)\n            y[i] = new int[i+1];\n        \n        build(a , x);\n        build(b , y);\n        \n        int ans[] = new int[k];\n        \n        for(int i=0;i<=k;i++){\n            int count1 = i;\n            int count2 = k-i;\n            if(count1<=n && count2<=m){\n                int left[] = new int[0];\n                int right[] = new int[0];\n                if(count1>0)\n                    left = x[count1-1];\n                if(count2>0)\n                    right = y[count2-1];\n                int now[] = max(left , right);\n                if(less(ans , now)<0){\n                    ans = now;\n                }\n            }\n        }\n        return ans;\n    }\n    \n    public int[] max(int a[] , int b[]){\n        int c[] = new int[a.length+b.length];\n        int i=0;\n        int j=0;\n        int k=0;\n        while(i<a.length && j<b.length){\n            if(a[i] == b[j]){\n                int x = check(a , b , i , j);\n                if(x == 0)\n                    c[k++] = a[i++];\n                else\n                    c[k++] = b[j++];\n            }\n            else if(a[i]>b[j])\n                c[k++] = a[i++];\n            else\n                c[k++] = b[j++];\n        }\n        while(i<a.length)\n            c[k++] = a[i++];\n        while(j<b.length)\n            c[k++] = b[j++];\n        return c;\n    }\n    \n    public int check(int a[] , int b[] , int s1 , int s2){\n        // 0 -> a 1 -> b\n        int i=s1;\n        int j=s2;\n        while(i<a.length && j<b.length){\n            if(a[i] == b[j]){\n                i++;\n                j++;\n                continue;\n            }\n            if(a[i]<b[j])\n                return 1;\n            else\n                return 0;\n        }\n        if(i == a.length)\n            return 1;\n        return 0;\n    }\n    \n    public void build(int a[] , int x[][]){\n        for(int i=0;i<a.length;i++){\n            int num = a[i];\n            if(i == 0){\n                x[i][0] = num;\n                continue;\n            }\n            for(int j=i;j>0;j--){\n                int res = less(x[j] , x[j-1]);\n                if(res>0);\n                else if(res == 0){\n                    if(x[j][j]<num){\n                        x[j][j] = num;\n                    }\n                }\n                else{\n                    copy(x[j-1] , x[j]);\n                    x[j][j] = num;\n                }\n            }\n            if(x[0][0]<num)\n                x[0][0] = num;\n        }\n    }\n    \n    public void copy(int a[] , int b[]){\n        for(int i=0;i<a.length;i++)\n            b[i] = a[i];\n    }\n    \n    public int less(int a[] , int b[]){\n        // 0 -> equal -1 -> less 1 -> more\n        for(int i=0;i<Math.min(a.length , b.length);i++){\n            if(a[i] == b[i])\n                continue;\n            else if(a[i]<b[i])\n                return -1;\n            return 1;\n        }\n        return 0;\n    }\n    \n}\n```
['Dynamic Programming', 'Greedy', 'Java']