Two Out of Three
A easy-tier problem at 77% community acceptance, tagged with Array, Hash Table, Bit Manipulation. Reported in interviews at Booking.com and 1 others.
Two Out of Three is an easy problem asked by Booking.com and Info Edge that sounds trivial but trips candidates who overthink it. You're given three arrays and need to return distinct integers that appear in at least two of them. The 76% acceptance rate hides a common mistake: candidates build hash tables for all three arrays separately, then cross-reference like they're solving a harder problem. The actual trick is simpler. If you blank on the approach during your live assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Two Out of Three"
Two Out of Three is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe naive instinct is to hash all elements from each array and then check membership across them. That works but feels overengineered. The real pattern is to track which arrays contain each number, then filter for those that appear in two or more. You can use a hash table with counts or a bit-set approach since there are only three arrays. The common pitfall is handling duplicates within a single array correctly and forgetting to return distinct values in the result. Many candidates also miss that you don't need to preserve order. Bit Manipulation is listed as a topic because you can use bitmasks to represent which arrays contain a number, making the logic cleaner. StealthCoder is the hedge if you hit this during an online assessment and the approach doesn't click immediately.
Pattern tags
You know the problem.
Make sure you actually pass it.
Two Out of Three recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Two Out of Three interview FAQ
Is this really just a hash table problem?+
Mostly, yes. You hash elements from each array and track frequency or presence across arrays. The bit manipulation topic suggests using a 3-bit mask to mark which arrays contain each number, which is more elegant than three separate hash tables. Both work at this difficulty level.
What's the trick that makes it easy?+
The trick is realizing you don't need to solve it with complex cross-referencing. Iterate through one array, check if each element exists in the other two, and collect those that do. Use a set for O(1) lookup. The 76% acceptance rate reflects that most candidates find this once they stop overcomplicating.
Do I need to return the result in a specific order?+
No. The problem allows any order in the output. This removes a sort step and simplifies the solution. Just collect distinct integers that meet the criteria and return them. That's likely why acceptance is so high.
How does this relate to the other topics listed?+
Array is obvious. Hash Table is the go-to data structure for tracking presence. Bit Manipulation is optional but elegant: use three bits to represent which arrays contain a number, making the 'at least two' check a single bitwise operation.
Is this still asked at Booking.com and Info Edge?+
Yes, both companies have reportedly asked it. Easy problems like this are screening filters. They test whether you can code cleanly under pressure and avoid over-engineering. If you've seen it before, solve it in under five minutes to build confidence.
Want the actual problem statement? View "Two Out of Three" on LeetCode →