Skip to main content

Practice · 1 of 1

Linear-time intersection

CHALLENGE
Difficulty: advanced+25 XP

Implement find_common(a, b, counter) returning the sorted list of values present in BOTH lists a and b. counter enforces a probe budget: call counter.seed(b) ONCE to load b, then for each element of a call counter.membership(x) — that is the only allowed membership test. The graded test asserts the result is correct AND that exactly len(a) membership probes were made.

Back to lesson: Practice: Complexity Practice