Answer: DIGIT INSURANCE Hiring On-Campus OA (2021) | Two Out of Three Problem

Answer · Posted Jun 2026

Approach Use a HashMap to count in how many arrays each number appears. Since duplicates within the same array should be counted only once: Convert each array into a Set. Update frequency count for each unique value. Collect numbers whose count is at least 2. Strategy Convert each array into a set. Maintain a frequency map. Increment count once per array. Return all values with frequency ≥ 2. Java Solution: import java.util.*; class Solution { public List<Integer> twoOutOfThree( int[] nums1, ...

The full answer & interview discussion are available to premium members.

Log in Create a free account