Skip to main content

Practice ยท 1 of 1

Linear-time intersection

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.

Difficulty: advanced

Back to lesson: Practice: Complexity Practice