PythiloEasy · 12 min · Task 34 of 100 · progress kept in this browser

Intersect sorted lists

Return the sorted multiset intersection of two sorted integer lists. Retain each value the smaller number of times it occurs.

a, b = [1, 2, 2], [2, 2, 3]
i = j = 0
print(a[i] < b[j])  # advance only i
Your task

Return the sorted multiset intersection of two sorted integer lists. Retain each value the smaller number of times it occurs.