Instructions

Click on the puzzle title to see the description and two expandable sections - one is for a brief hint (of dubious utility) and the other is for the puzzle solution. Click on the title again to collapse it. Feel free to send me new puzzles and/or improved answers to the list below. (Yes, I know the site needs formatting and a classification of easy/medium/hard would be nice too). Enjoy!
Milk with your Coffee - or is it Coffee with your Milk?
You have two containers of equal size. Container A is filled with coffee. Containder B is filled with an equal amount of milk. Now take a teaspoon of milk and stir into into the coffee so that it is uniformly distributed (don't worry about anything slopping over the side). Now, take a teaspoon of that mixture and stir it back into the milk so that it is uniformly distributed. Now, is there more milk in container A or more coffee in container B?
Hint
You might want to consider a particular value for the original amount of milk/coffee - if there is a general solution, it should work with any original amount - pick one that is really easy to calculate.
Solution
The amounts are the same - i.e. there is the same amount of milk in the coffee container (A) as there is coffee in the milk container (B). To see this, let's pick an easy amount to start with. Assume that A holds one teaspoon of coffee and B holds one teaspoon of milk. Now, we take that one teaspoon of milk and mix into into the one teaspoon of coffee (a 50/50 mix). Now, we take one teaspoon of that mixture (which will be 1/2 teaspoon of milk, 1/2 teaspoon of coffee) and mix that back into container (B) (which in this case, is all that is in container B). As you can easily see, there is now 1/2 teaspoon of coffee in (B) (the milk container) and furthermore, there is 1/2 teaspoon of milk remaining in (A) (the coffee container). Since the amounts are the same in this example, they must be the same in all container sizes (since the problem does not specify a container size) (and, it does work out mathematically, it is just more complicated).
Let's Make a Deal!
If you recall the Monty Hall show "Let's Make a Deal", this problem will be familiar to you. Monty presents you with a choice of three doors, behind one of them is $1M, behind the other two are farm animals (I believe donkeys were popular on the show). Needless to say, you want to win the $1M and have no interest in the farm animals. Monty asks you to pick a door - assume that you pick Door #1. Monty then reveals that behind one of the other doors is a group of farm animals. Monty then offers you the opportunity to change your door choice. What should you do? And, what is the probability of winning the $1M if you have the optimal strategy?
Hint
Your first choice was probably wrong
Solution
The easiest way to look at this problem is to consider the two possible strategies. Strategy A: Don't change your mind. The probability that this strategy will win is clearly 33%. Strategy B: Change your mind. To determine the winning probability for this strategy, we first note that no matter which door you picked first, Monty can always show you the farm animals (since there are two sets to choose from). If you initially picked a winning door, and you change, you will be going to the other farm animal door. Similarly, if you intitially picked a farm animal door, and you change, you will go to the winning door. Since the probability of initially picking a winner is 1/3, the probability of initially picking a loser is 2/3 and since strategy B turns winners to losers and vice versa, the probability of winning with strategy B is 2/3. Thus, you should take Monty's offer to change your mind and your odds of winning will be 2/3 - a significant improvement over the "don't change" strategy.
Losing Your Marbles
You have 100 marbles, 50 are red, 50 are blue. Your task is to distribute these marbles into two jars in order to maximize the chance of having a red marble drawn from the jars. However, the marble will be drawn from the jar in a particular way. First, the drawer will have to pick a jar (sight unseen) and then will blindly place his/her hand into the chosen jar and remove a marble randomly (the red/blue marbles are identical except for color). How can you distribute the marbles to maximize the chance of a red marble being drawn and what will that probability be?
Hint
Focus on the "two-step" nature of the marble selection process
Solution
Put one red marble in one of the jars, all the other marbles in the second jar. Thus, if the person selects the first jar, there is a 100% certainty they will pick a red marble (it is the only one). If the person selects the second jar, there is a 49/99 chance of selecting a red marble. The overall probability is 1/2 + 49/198, or just a shade under 3/4.
Twelve Coins on the Scale
You have 12 coins, one of which is "bad" (it may be heavy, it may be light), and a pan balance (e.g. you can put some coins in the left pan, some coins in the right pan, and see what happens). You have three weighings to determine which coin is bad and whether it is heavy or light.
Hint
Try to divide the problem in 3 each weighing
Solution
Label the coins 1234567890ab
Weighing 1: 1234 vs. 5678
If they balance (12345678 all good): 
  Weighing 2: 123 vs. 90a
  	If they balance (b is bad): 
  		Weighing 3: 1 vs. b
  			If b goes up, it is light, else it is heavy
  	If 123 goes down (then one of 90a is light)
  		Weighing 3: 9 vs. 0
  			If they balance, a is light
  			If they don't balance, whichever goes up is light
If not (assume 1234 goes down, 5678 goes up (1234 heavy or 5678 light, 90ab are good):
	Weighing 2: 178 vs. 53b
			If they balance (then those 6 are good), then 2 heavy, 4 heavy, or 6 light
				Weighing 3: 2 vs 4
					If they balance - then 6 is light
					If 2 goes down - then 2 is heavy
					If 2 goes up - then 4 is heavy
			If 178 goes down, then either 1 heavy or 3 light
				Weighing 3: 1 vs b (a known good)
					If they balance, 3 light
					If 1 goes down, then 1 heavy
			If 178 goes up, then either 7 light, 8 light, or 3 heavy
				Weighing 3: 7 vs. 8
					If they balance - then 3 heavy
					If 7 goes down - then 8 light
					If 7 goes up - then 7 light
Sending a Present - The Russian Postal System
Problem: Alice wants to send a valuable item to Bob, but unfortunately Alice lives in Moscow and Bob lives in St. Petersberg and thus, Alice must use the Russian postal system. The postal system operates under the following rules:
  • If an item is not sent in a standard sized box, it is deemed not valuable and is thrown away
  • If an item is sent in a standard sized box, but the box is not locked, it is deemed valuable and the contents are stolen by the postal workers
  • If an item is sent in a standard sized box, and the box is locked, it will be delivered.
  • Locks are opened by keys (they are not combination locks) - and no one will have a key to your lock - unless you can send it to them in such a way that it won't be lost or stolen by the postal service
The question is: How can Alice send her valuable item to Bob? Note: Boxes can have multiple locks, boxes can be sent inside boxes (assume that there are plenty of standard sizes, but you could not send a box in the shape of a key)
Hint
Use multiple locks
Solution
Alice puts the valuable item in a box, locks the box with her key, sends it to Bob. Bob looks at the box, and merely adds his lock to the box (now it has two locks) and sends it back to Alice (since it has locks, it makes it through the system). Alice gets the box, removes her lock and puts it back in the mail to Bob (again, since there is a lock on the box, it makes it through the system). Bob gets the box, removes his lock (the only one remaining) and opens the box.
Quartering the Circle
Given a circle, can you draw a continuous line that ends and starts in the same place, never crosses itself, never retraces itself, does not travel along the circumference of the circle, and provably cuts the circle into four distinct pieces of equal size?
Hint
A circle with radius 1/2 the original has area 1/4 the original
Solution
Imagine the circle as a compass (for easier description). Start at the West point and draw the top half of a circle with radius 1/2. When you reach the center of the big circle, start another top half of a circle with radius 1/2. This will put you at the East point. Now go the other way and draw the bottom halves of the circles, ending at the West point. Each circle is 1/4 the original area. And the remaining pieces (above and below the circles) are obviously equal (due to symmetry), so they are also 1/4 the area of the original circle.
A Slice of Butter - Well, Actually Five Slices
Imagine that you have a big block of butter. You have to make five slices through this block of butter, with the goal of creating as many individual pieces as possible. You cannot move the butter pieces (e.g., you can't cut it in half, stack the two halves, recut, restack, etc.) With five slices, what is the maximum number of pieces that can be created.
Hint
Try this in two dimensions first.
Solution
Let's start with the two dimensional case. In this scenario, the question is how many regions can we create by drawing 5 lines. The first important point is that each new line can intersect each existing line. So, the second line intersects the first, the third line intersects the first two lines and so forth. Now, let's focus on those counting intersections. With two lines, we have 1 intersection and 4 regions. Now, when we add our new line, it must be on one side of the intersection or the other (going through the intersection is not optimal). Thus, the line splits all the existing regions on one side of the intersection and does nothing to the region(s) on the other side. Thus, our third line yields 3 new regions (4 available to be split, 1 missed, implies 3 regions split, which is 3 new regions) for a total of 7. Also, since our third line intersected the other two, we now have 3 intersection points. Consider the fourth line, there are 7 regions to be split, but 3 of those (one for each intersection) will be on "the other side" of the intersection and not split. So, 4 will be split, giving us 11 regions and we will also get 3 new intersections for a total of 6. The pattern can be summarized in the table below:
Lines [i]Intersections [Int(i)]Regions [Reg(i)]
214
33 (=1+2)7 (=2*4-1)
46 (=3+3)11 (=2*7-3)
510 =(6+4)16 (=2*11-6)
ii-1 + Int(i-1)2*Reg(i-1)- Int(i-1)
OK, now we can move onto the 3D case. Similar concept, but somewhat harder to envision. We will still count intersections and regions, but now an intersection is where three planes come together to form a point. We start as before, with the statement that each new plane can be placed so that it will intersect all existing planes. However, the ith plane will not create a simple i-1 new intersections (as the ith line did in the 2D case), but rather it will create a new intersection for each pair of existing planes (as it cuts through the lines where the planes intersect to create a point), or (i-1) C 2 (where x C y is the number of combinations that can made by choosing y things from a set of x things) new intersections. And as before, our new plane will split all existing regions, except for one region per intersection (the one on the "other side"). So, constructing our chart again.
Planes [i]Intersections [Int(i)]Regions [Reg(i)]
318
44=(4-1) C 2 + 115=2*8-1
510=(5-1) C 2 + 426=2*15-4
620=(6-1) C 2 + 1042=2*26-10
i(i-1) C 2 + Int(i-1)2*Reg(i-1)- Int(i-1)
We see that the answer to our question is 26.

The closed form of the form of the formula for Reg(n) for the 2D case is: n(n+1)/2 + 1. For the 3D case, Reg(n) = (n+1)*(n^2-n+6)/6 = (n^3 + 5n + 6) / 6. Also, if you have a sequence and want the closed form formula for that sequence, a great site is: http://www.research.att.com/~njas/sequences/index.html

Getting Water to Camp
This graphical problem is also slightly difficult to describe in text, but here goes. Imagine that you are camping out - and conveniently, you are camping out a piece of graph paper. Your camp is at (a, b), and your friends camp is at (c, d) where a, b, c, d are all positive integers. There is a river that runs along the x-axis (e.g. all points (*, 0). Your task is to find the shortest path that takes you from your camp to your friends camp, but allows you to get some water along the way (e.g. you must go the river before you get to your friend's camp).
Hint
Well, the shortest distance between two points is a straight line.
Solution
Since you can't draw a straight line that has (a, b), (x, 0), and (c, d), reflect (c, d) to be (c, -d). Now, you can draw a straight line from (a, b) to (c, -d) that must go through the x-axis. This is the shortest path from (a, b) to (c, -d) and since it is the same length as the path from (a, b) to (c, d) (since it was created by reflection) it is also the shortest path between those points. So, find the point where this line intercepts the x-axis, call that point X. The shortest path from (a, b) to (c, d) that touches the river will be the straight line from (a, b) to (X, 0) + straight line from (X, 0) to (c, d).
Unique Number
What is unique about the number 46587?
Hint
One aspect of the uniqueness is that it contains 5 digits, all of which are unique - and all of which are in sequence (e.g. 4-8). What other operation strangely enough preserves both this uniqueness and sequence property?
Solution
46857 squared is 2170348569 which has 10 digits, all of which are unique and all of which are in sequence. No other number has these two properties.
Cheating Wives
There is a town, with 100 couples (100 is not important, pick any reasonably large number). Every person is married to another person (e.g. there are no unattached singles). One day the chief wakes up and says that he has had the revelation that there are some women (1 or more) in the town who are cheating on their husbands. This town is such that if a woman is cheating, then every man in the town knows it, except for her husband. The men are all perfect logicians, but do not speak to each other. The chief instructs all the men in the town that on the day they can deduce that their wife is cheating, they should shoot her at midnight. That night at midnight, all is quiet. The next night at midnight, all is quiet. The following night, at midnight, shots ring out. How many women were cheating?
Hint
What does NOT happen is just as important as what does happen.
Solution
There are three women cheating. The way to see this is to think about what the situation would be like if there was one woman cheating. If there was a single woman who was cheating, then everyone except her husband knew about it. Her husband thought that there were no cheaters. Thus, when the chief announced that there were 1 or more women cheating, he would have immediately realized that his wife must the cheater. Thus he would have shot her at midnight. However, this did NOT happen, therefore there is more than one woman cheating. Could there be two women cheating? If there were, then there are two men who think that there is only ONE woman cheating (remember, they don't know about their own wives). So, when the chief makes his announcement, they are expecting that on the first night, that ONE woman's husband will shoot her (as per the above discussion). However, when all is quiet on the first night, they realize that there wasn't just ONE woman cheating, and since they only know of ONE woman, their wives must in fact also be cheating, so on the second night, both these husbands would shoot their wives. However, this did NOT happen. Continuing in this vein we can see that if shots rang out on the third night, it was from the three husbands who only knew of two cheating women (the wives of the other two). They expected to hear shots on the second night and when that didn't happen, all three husbands they shot their wives on the third night (which is the night when the shots rang out).
Going in Circles?
You have a linked list and you want to determine if that list has a "loop" in it - e.g., if traversing the links will eventually bring you back to a node that you have visited before. Can you describe an algorithm that will determine if there is a loop, and operate in O(n) time and O(1) space (if you are not familiar with "Big O" notation, it basically means find an algorithm where the number of steps is proportional to the number of nodes in the list and uses only a constant amount of memory - even as n increases arbitrarily).
Hint
Think about race car drivers driving around an oval (perhaps)
Solution
TPerform two simultaneous link traversals - where the second traversal goes twice as fast ast the second. If the two traversals are ever at the same node at the same time, then the second has "lapped" the first and that can only happen if there is a circle. If there is a circle, it be shown that the lapping will occur in O(n) time (2 or 4 laps, depending on the parity of n), and no additional storage is needed.
All Linked Up
How to traverse a list with only a single link field in both directions. If you are familiar with linked lists, the lists usually point in one direction - to the "next" node in the list. Usually, if you want to be able to move forwards and backwards through the list, you have to have two link fields, one pointing at your "left" neighbor and one pointing at your "right" neighbor. The question is, how can you traverse a list in both directions, if you are allowed to have only one link field? (You can store anything you want in there, but you only have 32 bits - assuming a 32 bit address space). You can also use a fixed amount of additional space (e.g., it can't grow with the size of the list)
Hint
Find x, such that combining x with L generates R but combining x with R generates L.
Solution
Store the XOR of your Left and Right neighbor's addresses in your link field and keep the previous address in a single memory location. If you are coming from the left, take the left address from memory and XOR it to the link field, resulting in LEFT XOR (LEFT XOR RIGHT), which conveniently turns out to be RIGHT, which where you want to go. If you are coming from the right, the previous address is RIGHT, so the equation becomes RIGHT XOR (LEFT XOR RIGHT), which conveniently is exactly equal to LEFT and allows you to continue traversing in that direction.
How old are the kids?
One day Alice meets Bob, not having seen Bob in a while, she asks how his kids are doing. "You have two children, right?" she asks - "Now how old are they again?". Bob says, "Let me answer the question this way - I have three kids. The product of their ages is 36. The sum of their ages is exactly the same as the number of windows on the building behind us." "Wait" says Alice, "that isn't enough information to solve the problem". "Oh", says Bob, "you are right, more information is needed - ok, the oldest has red hair". What are the ages of the three children?
Hint
Both Alice and Bob know how many windows there are on the building, but under what circumstance would that not provide enough information to solve the problem.
Solution
There are 8 of different ways to have three numbers whose product is 36 - e.g. (1, 1, 36), (1, 2, 18), (1, 3, 12), (1, 4, 9), (1, 6, 6), (2, 2, 9), (2, 3, 6) and (3, 3, 4). However, almost all of those possibilities sum to a unique number. For example, if the number of windows was 38, then we would know that the answer is (1, 1, 36) since that is the only triple that sums to 38. However, even though we don't know the number of windows, Alice and Bob do. Thus, when Alice says she needs more information, it must be that there are two triples that sum to the same number (and there are only two) - those are (1, 6, 6) and (2, 2, 9). Since the third clue is that the eldest has red hair, there must be an eldest (vs. a pair of older twins) and thus the answer is that the kids are 2, 2, and 9.
RHB-Words
How many words can you find that have the following unusual properties? (1) You can split the word exactly in half, and each of the halves are words. (2) Not only are the halves words, but they are anagrams of each other and (3) The two halves are different.
Hint
An example (and the first one I found) is "teammate". "team" and "mate" are both words and they are anagrams.
Solution
I know of only four solutions to this problem. "teammate" and "noon" I solved by just thinking long and hard. I then wrote a program that found "reappear" (reap/pear) and then the redoubtable Jim Mayfield used a bigger dictionary to find "horseshoer" (horse/shoer). Note: I call these RB-words, since I believe that I am the first person to describe them (and yes, I did search the web).
Dave-Words and Other Anagram Trivia
Everyone has probably seen a STOP sign and wondered, hmmm, how many anagrams can I make from "stop". When they discover the five other words (opts, post, pots, spot, tops) they might wonder - is there a four letter word with more than six anagrams? What about three letter words, five letter words, etc. So, the question is: What are the top "anagram counts" for 3, 4, 5, and 6 letter words?
Hint
Words with "s" do well
Solution
I wrote a program to solve this (but unfortunately, I have lost the code, so some of this is from recollection). For "3", I believe winner is "tea", with four anagrams (ate, eat, eta). For "4" the winner is the above mentioned "stop", with six anagrams. For "5", the winners is "parse". "parse" has seven common anagrams - pares, pears, rapes, reaps, spare, spear - but according to www.dictionary.com, "prase" and "asper" are also words, for a total of 9! An honorable mention goes to "cater", which has seven anagrams - caret, carte, crate, react, recta, trace. For N="6", we have the somewhat unsatisfying "caster", which has eight anagrams - carets, cartes, caters, crates, reacts, recast, traces. In general, we define a Dave-word to be all words of length N that have at least N anagrams (in honor of Dave Cohn who defined the concept). I believe that there are no Dave-words for N > 6.
Random Word Puzzles
Three puzzles in one. (1) What English word has the highest consonant to vowel ratio? (2) What is the highest vowel to consonant ratio? (3) What word is most dominated by one letter - e.g. number of occurrences of that letter divided by word length is maximized? (4) What words have all six vowels - in alphabetical order?
Hint
No hints on this one :-) - note there may be better answers than the ones below - feel fre to let me know.
Solution
(1) strengths - 8 consonants, 1 vowel - ratio 8:1. (2) 4:1, an example is eerie. There are others. (3) "lull" is 75% Ls. I think there is at least one more that reaches 75%, but I don't recall it. (4) Facetiously. Note: the French word for bird "oiseau", is a fabulous word - it has a vowel consonant ratio of 5:1 and it has all five (primary) vowels.