Eight batteries, four good, one flashlight
Asked at Microsoft, Two Sigma
You have 8 batteries; exactly 4 are good and 4 are dead, but they look identical. Your flashlight needs two good batteries inserted together to turn on. One "test" means inserting some pair and seeing whether the flashlight lights.
What is the fewest number of tests that guarantees you get the flashlight working?