|
| 1 | +<h2><a href="https://leetcode.com/problems/two-out-of-three">Two Out of Three</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr>Given three integer arrays <code>nums1</code>, <code>nums2</code>, and <code>nums3</code>, return <em>a <strong>distinct</strong> array containing all the values that are present in <strong>at least two</strong> out of the three arrays. You may return the values in <strong>any</strong> order</em>. |
| 2 | +<p> </p> |
| 3 | +<p><strong class="example">Example 1:</strong></p> |
| 4 | + |
| 5 | +<pre> |
| 6 | +<strong>Input:</strong> nums1 = [1,1,3,2], nums2 = [2,3], nums3 = [3] |
| 7 | +<strong>Output:</strong> [3,2] |
| 8 | +<strong>Explanation:</strong> The values that are present in at least two arrays are: |
| 9 | +- 3, in all three arrays. |
| 10 | +- 2, in nums1 and nums2. |
| 11 | +</pre> |
| 12 | + |
| 13 | +<p><strong class="example">Example 2:</strong></p> |
| 14 | + |
| 15 | +<pre> |
| 16 | +<strong>Input:</strong> nums1 = [3,1], nums2 = [2,3], nums3 = [1,2] |
| 17 | +<strong>Output:</strong> [2,3,1] |
| 18 | +<strong>Explanation:</strong> 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 | +</pre> |
| 23 | + |
| 24 | +<p><strong class="example">Example 3:</strong></p> |
| 25 | + |
| 26 | +<pre> |
| 27 | +<strong>Input:</strong> nums1 = [1,2,2], nums2 = [4,3,3], nums3 = [5] |
| 28 | +<strong>Output:</strong> [] |
| 29 | +<strong>Explanation:</strong> No value is present in at least two arrays. |
| 30 | +</pre> |
| 31 | + |
| 32 | +<p> </p> |
| 33 | +<p><strong>Constraints:</strong></p> |
| 34 | + |
| 35 | +<ul> |
| 36 | + <li><code>1 <= nums1.length, nums2.length, nums3.length <= 100</code></li> |
| 37 | + <li><code>1 <= nums1[i], nums2[j], nums3[k] <= 100</code></li> |
| 38 | +</ul> |
0 commit comments