Description

Given three integer arrays, return a distinct array containing all values that are present in at least two out of the three arrays.

Examples

Input:nums1 = [1,1,3,2], nums2 = [2,3], nums3 = [3]
Output:[3,2]
Explanation:

3 in all, 2 in two.

Input:nums1 = [1], nums2 = [1], nums3 = [1]
Output:[1]
Explanation:

The value 1 appears in all three arrays, so it is included in the result.

Input:nums1 = [4,5,6], nums2 = [1,2,3], nums3 = [7,8,9]
Output:[]
Explanation:

No values appear in at least two arrays - all arrays are completely disjoint with no common elements.

Constraints

  • 1 ≤ nums.length ≤ 100

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!