Skip to content
CodeItRaw
Code Reading
/
Common Items
Path
Play
Daily
Leaderboard
tr
Read the Big-O
Common Items
a and b are both lists of n items. How fast is this one-liner? Careful: what does
in
do on a list?
1
def
common
(a, b):
2
return
[x
for
x
in
a
if
x
in
b]