Startup / VO Coding Interview Question: Find Common Items in Two Lists

12 Views
No Comments

Given 2 lists, find the common items in both lists.

This problem asks you to find the common items shared by two lists. A standard solution is to store the elements of one list in a hash set, then scan the other list and collect values that also appear in the set. This keeps lookups efficient and usually gives an O(n + m) time solution. If duplicates matter, you can extend the approach with frequency counting; otherwise, a set is enough for a clean intersection result.

END
 0