2605. Form Smallest Number From Two Digit Arrays Easy

@problem@discussion
#Array#Hash Table#Enumeration



1/**
2 * [2605] Form Smallest Number From Two Digit Arrays
3 *
4 * Given two arrays of unique digits nums1 and nums2, return the smallest number that contains at least one digit from each array.
5 *  
6 * <strong class="example">Example 1:
7 * 
8 * Input: nums1 = [4,1,3], nums2 = [5,7]
9 * Output: 15
10 * Explanation: 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.
11 * 
12 * <strong class="example">Example 2:
13 * 
14 * Input: nums1 = [3,5,2,6], nums2 = [3,1,7]
15 * Output: 3
16 * Explanation: The number 3 contains the digit 3 which exists in both arrays.
17 * 
18 *  
19 * Constraints:
20 * 
21 * 	1 <= nums1.length, nums2.length <= 9
22 * 	1 <= nums1[i], nums2[i] <= 9
23 * 	All digits in each array are unique.
24 * 
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/form-smallest-number-from-two-digit-arrays/
29// discuss: https://leetcode.com/problems/form-smallest-number-from-two-digit-arrays/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34    pub fn min_number(nums1: Vec<i32>, nums2: Vec<i32>) -> i32 {
35        0
36    }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn test_2605() {
47    }
48}
49


Back
© 2025 bowen.ge All Rights Reserved.