C# Recursion + Memo
cs\npublic class Solution {\n\n    public int[] MaxNumber(int[] nums1, int[] nums2, int k) {\n        var lst = MaxNumber(GetMap(nums1), GetMap(nums2), nums1.Le
```cs\npublic class Solution {\n\n    public int[] MaxNumber(int[] nums1, int[] nums2, int k) {\n        var lst = MaxNumber(GetMap(nums1), GetMap(nums2), nums1.Length + nums2.Length, 0, 0, k); lst.Reverse();\n        return lst.ToArray();\n    }\n        \n    \n    private IDictionary<(int,int,int),List<int>> memo = new Dictionary<(int,int,int),List<int>>();\n    \n    private List<int> MaxNumber(IReadOnlyDictionary<int,List<int>> map1, IReadOnlyDictionary<int,List<int>> map2, int count, int pos1, int pos2, int k) {\n        \n        if (k == 0)\n            return new List<int>();\n        \n        var key = (pos1,pos2,k);\n        if (memo.TryGetValue(key, out List<int> m))\n            return new List<int>(m);\n        \n        var has1 = TryGetValue(map1, pos1, count - pos2 - k, out int val1, out int next1);\n        var has2 = TryGetValue(map2, pos2, count - pos1 - k, out int val2, out int next2);\n        \n        if (!has1 || has2 && val2 > val1) {\n            var list = MaxNumber(map1, map2, count, pos1, next2 + 1, k - 1); list.Add(val2);\n            memo[key] = new List<int>(list);\n            return list;\n        }\n            \n        if (!has2 || has1 && val1 > val2) {\n            var list = MaxNumber(map1, map2, count, next1 + 1, pos2, k - 1); list.Add(val1);\n            memo[key] = new List<int>(list);\n            return list;\n        }\n        \n        var list1 = MaxNumber(map1, map2, count, next1 + 1, pos2, k - 1);\n        var list2 = MaxNumber(map1, map2, count, pos1, next2 + 1, k - 1);\n        \n        var lst = IsLess(list1, list2) ? list2 : list1; lst.Add(val1);\n        memo[key] = new List<int>(lst);\n        return lst;\n    }\n    \n    private IReadOnlyDictionary<int,List<int>> GetMap(int[] nums) {\n        var dic = Enumerable.Range(0, 10).ToDictionary(i => i, i => new List<int>());\n        for(var i = 0; i < nums.Length; i++)\n            dic[nums[i]].Add(i);\n        return dic;\n    }\n    \n    private bool TryGetValue(IReadOnlyDictionary<int,List<int>> map, int from, int to, out int value, out int pos) {\n        for(value = 9; value >= 0; value--) {\n            var idx = map[value].BinarySearch(from);\n            if (idx < 0)\n                idx = ~idx;\n            if (idx >= map[value].Count)\n                continue;\n            if (map[value][idx] > to)\n                continue;\n            pos = map[value][idx];\n            return true;\n        }\n        pos = -1;\n        return false;\n    }\n    \n    private bool IsLess(List<int> lst1, List<int> lst2) {\n        for(var i = lst1.Count - 1; i >= 0; i--) {\n            if (lst1[i] < lst2[i])\n                return true;\n            if (lst1[i] > lst2[i])\n                return false;\n        }\n        return false;\n    }\n}\n```
['Recursion', 'Memoization', 'C#']