Log inBook a Demo
BuildMidBackendAuto-graded

Patch a filter that forgets items you added

A Bloom filter reports items you just added as missing. Make it keep its one promise: no false negatives.A Bloom filter may report false positives, but anything you add must always come back as present. The BloomFilter in bloom.py breaks that rule: items you have just added report as absent. Find out why and fix it, keeping the false-positive rate where the filter's size and hash count put it.
35 min
python

You're done when

  • Every item that was added reports as present: no false negatives.
  • This holds for byte inputs as well as strings.
  • The false-positive rate stays low for the filter's size and hash count.

What it measures

HashingDeriving several independent bit positions from one item, all inside the bit array.
Probabilistic guaranteesKnowing which error a Bloom filter is allowed to make and which one it must never make.
Testing the invariantChecking the fix against the no-false-negatives rule on a large set of items before calling it done.

Your environment

Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish

Start this lab

35 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo