Two Out of Three

Find all distinct values that appear in at least two out of three given integer arrays. Use bitmasks where each bit tracks presence in a specific array, then filter values with mask ≥ 2.

Examples
Input: [[1,1,2,3],[2,3],[4]]
Output: [2,3]
Hints

Two Out of Three

Find all distinct values that appear in at least two out of three given integer arrays. Use bitmasks where each bit tracks presence in a specific array, then filter values with mask ≥ 2.