Medium data structure and algorithm practice puzzle.
Given a filter of a fixed size, the bit positions each inserted key hashed to, and the positions of a key you are asking about, return whether the filter says it is present. Every position set means probably yes; any position clear means definitely no. The one-sided error is the whole design: a Bloom filter in front of a disk read can never send you looking for something that is not there, only occasionally waste a read on something that is not. Notice a query can come back true when nothing put those bits there together.
Solve it three ways: snap the jigsaw pieces together, fill in the blanks, or type it from scratch against the tests. This one is free.
Browse all 536 puzzles