2605. Form Smallest Number From Two Digit Arrays

Easy

207

9

Given two arrays of **unique** digits *the ***smallest** number that contains **at least** one digit from each array.

`nums1`

and `nums2`

, return

**Example 1:**

Input:nums1 = [4,1,3], nums2 = [5,7]Output:15Explanation:The number 15 contains the digit 1 from nums1 and the digit 5 from nums2. It can be proven that 15 is the smallest number we can have.

**Example 2:**

Input:nums1 = [3,5,2,6], nums2 = [3,1,7]Output:3Explanation:The number 3 contains the digit 3 which exists in both arrays.

**Constraints:**

`1 <= nums1.length, nums2.length <= 9`

`1 <= nums1[i], nums2[i] <= 9`

- All digits in each array are
**unique**.

Accepted

24.3K

Submissions

45.4K

Acceptance Rate

53.5%

Seen this question in a real interview before?

1/4

Yes

No

Discussion (0)

Related Topics

Copyright ©️ 2023 LeetCode All rights reserved