Search⌘ K
AI Features

Solution: Poor Pigs

Understand how to solve the Poor Pigs problem by analyzing rounds of testing and possible outcomes to find the poisonous bucket. Learn to apply mathematical reasoning and logarithmic formulas to calculate the minimum number of pigs required within a given time frame.

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 ...