← Back to challenges

Three Lists!

PythonHardarraysinterviewmathnumbers

Instructions

Given three lists of integers: lst1, lst2, lst3, return the sum of integers which are common in all three lists.

Examples

sum_common([1, 2, 3], [5, 3, 2], [7, 3, 2]) ➞ 5
// 2 & 3 are common in all 3 lists.

sum_common([1, 2, 2, 3], [5, 3, 2, 2], [7, 3, 2, 2]) ➞ 7
// 2, 2 & 3 are common in all 3 lists.

sum_common([1], [1], [2]) ➞ 0

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Good Match?