2032. Two Out of Three Easy

@problem@discussion
#Array#Hash Table



1/**
2 * [2032] Two Out of Three
3 *
4 * Given three integer arrays nums1, nums2, and nums3, return a distinct array containing all the values that are present in at least two out of the three arrays. You may return the values in any order.
5 *  
6 * Example 1:
7 * 
8 * Input: nums1 = [1,1,3,2], nums2 = [2,3], nums3 = [3]
9 * Output: [3,2]
10 * Explanation: The values that are present in at least two arrays are:
11 * - 3, in all three arrays.
12 * - 2, in nums1 and nums2.
13 * 
14 * Example 2:
15 * 
16 * Input: nums1 = [3,1], nums2 = [2,3], nums3 = [1,2]
17 * Output: [2,3,1]
18 * Explanation: The values that are present in at least two arrays are:
19 * - 2, in nums2 and nums3.
20 * - 3, in nums1 and nums2.
21 * - 1, in nums1 and nums3.
22 * 
23 * Example 3:
24 * 
25 * Input: nums1 = [1,2,2], nums2 = [4,3,3], nums3 = [5]
26 * Output: []
27 * Explanation: No value is present in at least two arrays.
28 * 
29 *  
30 * Constraints:
31 * 
32 * 	1 <= nums1.length, nums2.length, nums3.length <= 100
33 * 	1 <= nums1[i], nums2[j], nums3[k] <= 100
34 * 
35 */
36pub struct Solution {}
37
38// problem: https://leetcode.com/problems/two-out-of-three/
39// discuss: https://leetcode.com/problems/two-out-of-three/discuss/?currentPage=1&orderBy=most_votes&query=
40
41// submission codes start here
42
43impl Solution {
44    pub fn two_out_of_three(nums1: Vec<i32>, nums2: Vec<i32>, nums3: Vec<i32>) -> Vec<i32> {
45        vec![]
46    }
47}
48
49// submission codes end
50
51#[cfg(test)]
52mod tests {
53    use super::*;
54
55    #[test]
56    fn test_2032() {
57    }
58}
59


Back
© 2025 bowen.ge All Rights Reserved.