Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

321. Create Maximum Number #9

Open
F4NT0 opened this issue Apr 20, 2024 · 0 comments
Open

321. Create Maximum Number #9

F4NT0 opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
Hard Hard Questions Ready to code Description from the Question was updated with code and text

Comments

@F4NT0
Copy link
Owner

F4NT0 commented Apr 20, 2024

You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digits of two numbers. You are also given an integer k.

Create the maximum number of length k <= m + n from digits of the two numbers. The relative order of the digits from the same array must be preserved.

Return an array of the k digits representing the answer.

Example 1:

  • Input: nums1 = [3,4,6,5], nums2 = [9,1,2,5,8,3], k = 5
  • Output: [9,8,6,5,3]

Example 2:

  • Input: nums1 = [6,7], nums2 = [6,0,4], k = 5
  • Output: [6,7,6,0,4]

Example 3:

  • Input: nums1 = [3,9], nums2 = [8,9], k = 3
  • Output: [9,8,9]

Constraints:

  • m == nums1.length
  • n == nums2.length
  • 1 <= m, n <= 500
  • 0 <= nums1[i], nums2[i] <= 9
  • 1 <= k <= m + n
@F4NT0 F4NT0 added the Hard Hard Questions label Apr 20, 2024
@F4NT0 F4NT0 added this to the April Leetcode milestone Apr 20, 2024
@F4NT0 F4NT0 self-assigned this Apr 20, 2024
@F4NT0 F4NT0 added the Ready to code Description from the Question was updated with code and text label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hard Hard Questions Ready to code Description from the Question was updated with code and text
Projects
None yet
Development

No branches or pull requests

1 participant