Skip to content

Instantly share code, notes, and snippets.

@AurelienGasser
Created January 24, 2017 01:06
Show Gist options
  • Save AurelienGasser/aedc22d69be3670427ef609227ad50e8 to your computer and use it in GitHub Desktop.
Save AurelienGasser/aedc22d69be3670427ef609227ad50e8 to your computer and use it in GitHub Desktop.
You give a 1-1000 number to each bottle.
You convert that number to binary. The maximum number (1000) takes 10 digits (decimal 1000 == binary 1111101000)
You number each rat 1-10.
For each bottle, you make the Nth rat drink if the bottle's Nth digit is 1.
You see which rats die, and determine the binary code for the poisoned bottle.
e.g.
if rats 2,3,8 die
then bottle 0010000110 is poisoned
i.e. bottle 134 is poisoned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment