Lexicographically Largest Array based Answer
IntuitionThe problem requires finding the lexicographically greatest subsequence of a given length from two arrays. The key idea is to leverage the greatest sub
### Intuition
The problem requires finding the lexicographically greatest subsequence of a given length from two arrays. The key idea is to leverage the greatest subsequence from each array and then merge them in a way that maintains the lexicographical order.

### Approach
1. **Greatest Subsequence Function**: Create a helper function to find the lexicographically greatest subsequence of a given length from a single array.
2. **Combination and Comparison**: For each possible split of the total length `k` between the two arrays, find the greatest subsequences from both arrays and merge them.
3. **Merge Logic**: Merge the two subsequences by comparing elements to maintain the lexicographical order.
4. **Result Update**: Keep track of the best result found during the merging process.

### Complexity
- **Time complexity**: 
  - The helper function `getGreatestSubsequence` runs in $$O(n)$$ time for each array.
  - The merging process runs in $$O(k)$$ time for each combination.
  - Overall, the time complexity is $$O(k \cdot (n + m))$$, where `n` and `m` are the lengths of the two input arrays.

- **Space complexity**: 
  - The space complexity is $$O(k)$$ for storing the result and intermediate arrays.

# Code
```java []
class Solution {
    private static int[] getGreatestSubsequence(int[] array, int length) {
        int n = array.length;
        int[] result = new int[length];
        int j = 0;

        for (int i = 0; i < n; i++) {
            while (j > 0 && result[j - 1] < array[i] && j + n - i > length) {
                j--;
            }
            if (j < length) {
                result[j++] = array[i];
            }
        }

        return result;
    }

    public int[] maxNumber(int[] nums1, int[] nums2, int k) {
        int[] res = new int[k];
        for (int i = 0; i <= k; i++) {
            if (i > nums1.length || k - i > nums2.length) continue;
            int[] current = new int[k];
            int[] res1 = getGreatestSubsequence(nums1, i);
            int[] res2 = getGreatestSubsequence(nums2, k - i);
            System.out.println(Arrays.toString(res1));
            System.out.println(Arrays.toString(res2));
            int l = 0, j = 0;
            while (l < res1.length && j < res2.length) {
                if (res1[l] > res2[j]) {
                    current[l + j] = res1[l];
                    l++;
                } else if (res1[l] < res2[j]) {
                    current[l + j] = res2[j];
                    j++;
                } else {
                    // Compare the remaining parts to decide
                    int[] remaining1 = Arrays.copyOfRange(res1, l, res1.length);
                    int[] remaining2 = Arrays.copyOfRange(res2, j, res2.length);
                    if (Arrays.compare(remaining1, remaining2) > 0) {
                        current[l + j] = res1[l];
                        l++;
                    } else {
                        current[l + j] = res2[j];
                        j++;
                    }
                }
            }
            while (l < res1.length) {
                current[l + j] = res1[l];
                l++;
            }
            while (j < res2.length) {
                current[l + j] = res2[j];
                j++;
            }
            if (Arrays.compare(current, res) > 0) {
                res = current;
            }
        }
        return res;
    }
}
```
['Array', 'Java']