AI Features

Solution: Poor Pigs

Let's solve the Poor Pigs problem using the Math and Geometry pattern.

Statement

You have buckets buckets of liquid, exactly one of which is poisonous. Your goal is to identify the poisonous bucket by feeding liquid to some number of pigs and observing whether they survive or die. You have a total of minutesToTest minutes to determine which bucket contains the poison.

The experiment proceeds in rounds according to the following rules:

  • Select any number of live pigs to feed during this round.

  • For each selected pig, choose any subset of buckets to feed it. The pig drinks from all chosen buckets simultaneously and instantaneously. Any pig ...