mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
27 lines
1.0 KiB
HTML
27 lines
1.0 KiB
HTML
Given two arrays of <strong>unique</strong> digits <code>nums1</code> and <code>nums2</code>, return <em>the <strong>smallest</strong> number that contains <strong>at least</strong> one digit from each array</em>.
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> nums1 = [4,1,3], nums2 = [5,7]
|
|
<strong>Output:</strong> 15
|
|
<strong>Explanation:</strong> 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.
|
|
</pre>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> nums1 = [3,5,2,6], nums2 = [3,1,7]
|
|
<strong>Output:</strong> 3
|
|
<strong>Explanation:</strong> The number 3 contains the digit 3 which exists in both arrays.
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= nums1.length, nums2.length <= 9</code></li>
|
|
<li><code>1 <= nums1[i], nums2[i] <= 9</code></li>
|
|
<li>All digits in each array are <strong>unique</strong>.</li>
|
|
</ul>
|