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.
&nbsp;
Example 1:

Input: nums1 = [1,1,3,2], nums2 = [2,3], nums3 = [3]
Output: [3,2]
Explanation: The values that are present in at least two arrays are:
- 3, in all three arrays.
- 2, in nums1 and nums2.


Example 2:

Input: nums1 = [3,1], nums2 = [2,3], nums3 = [1,2]
Output: [2,3,1]
Explanation: The values that are present in at least two arrays are:
- 2, in nums2 and nums3.
- 3, in nums1 and nums2.
- 1, in nums1 and nums3.


Example 3:

Input: nums1 = [1,2,2], nums2 = [4,3,3], nums3 = [5]
Output: []
Explanation: No value is present in at least two arrays.


&nbsp;
Constraints:


	1 &lt;= nums1.length, nums2.length, nums3.length &lt;= 100
	1 &lt;= nums1[i], nums2[j], nums3[k] &lt;= 100


class Solution:
    def twoOutOfThree(self, nums1: List[int], nums2: List[int], nums3: List[int]) -> List[int]:
        output = []
        for i in nums1:
            if i in nums2 or i in nums3:
                if i not in output:
                    output.append(i)
        for j in nums2:
            if j in nums3 or j in nums1:
                if j not in output:
                    output.append(j)
        return output
class Solution {
    public List<Integer> twoOutOfThree(int[] nums1, int[] nums2, int[] nums3) {
        int[] bits = new int[101];
        for (int n : nums1) bits[n] |= 0b110;
        for (int n : nums2) bits[n] |= 0b101;
        for (int n : nums3) bits[n] |= 0b011;
        List<Integer> result = new ArrayList();
        for (int i = bits.length - 1; i > 0; i--)
            if (bits[i] == 0b111)
                result.add(i);
        return result;
    }
}
class Solution {
public:
    vector<int> twoOutOfThree(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3) {
        vector<int>f(110, 0);
        for (int n : nums1) f[n] |= 1<<0;
        for (int n : nums2) f[n] |= 1<<1;
        for (int n : nums3) f[n] |= 1<<2;
        
        vector<int>ret;
        for (int i = 1; i <= 100; i++) if (f[i] == 3 || f[i] >= 5) ret.push_back(i);
        return ret;
    }
};
var twoOutOfThree = function(nums1, nums2, nums3) {
    let newArr = [];
    newArr.push(...nums1.filter(num => nums2.includes(num) || nums3.includes(num)))
    newArr.push(...nums2.filter(num => nums1.includes(num) || nums3.includes(num)))
    return Array.from(new Set(newArr))
};
Two Out of Three