Information Theory

  • 0

    The problem can be directly solved by information theory.

    The information required for finding that bucket = -log2(1/1000)=9.97 big

    The information of x pigs in one drink = x bit and the pigs can drink four times in one hour. x= ceil(-log2(1/1000) / 4) = 3

  • 0

    I was thinking along these lines as well—the flaw in this approach is that you can't re-use dead pigs! If you try to use x bits per drink, there is a chance ALL of your pigs will die in the first 15 minutes at which point the algorithm fails.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.