Search⌘ K
AI Features

Solution: Poor Pigs

Understand how to solve the poison bucket problem by calculating the minimum pigs needed to guarantee identification within a time limit. Explore the method of counting distinguishable outcomes, using rounds of testing, and applying logarithmic calculations to optimize the number of pigs required. Practice this approach to enhance your problem-solving skills with math and geometry concepts in coding interviews.

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