Ctrl K

In at Least Two Lists

Easy
You are given three integer lists: first, second and third. Find every value that appears in at least two of the three lists. Each such value must appear in the answer exactly once, even if it repeats inside the lists. The values may be returned in any order.
Example 1
first=[4, 9, 4], second=[9, 12], third=[12, 7] → [9, 12]

9 appears in the first and second lists, 12 in the second and third. 4 and 7 appear in only one list each; repeating 4 inside the first list does not count.

Example 2
first=[1, 2], second=[3], third=[4, 5] → []

No value is shared, so the answer is empty.

Constraints
  • 1 ≤ len(first), len(second), len(third) ≤ 100
  • Every value is between 1 and 100
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsThe Lost Ticket EasyDoubled Tag, Lost Tag EasyWords From Working Keys EasyMatching Sock Pairs EasyPairs With the Same Letter Set Easy
loading Python…
Input
first=[4, 9, 4], second=[9, 12], third=[12, 7]
Expected
[9, 12]

Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.