• subscribe
October 26, 2006 12:00 AM

The Logical Puzzle

SQL Server Pro
InstantDoc ID #93727
October’s Puzzle: Shaking Hands
My wife and I were at a party recently with four other married couples. All the people who didn't know each other shook hands. Of course, each person knew his or her spouse. I asked each of the nine other people at the party how many hands they shook and received all possible answers ranging from 0 through 8. Each person shook a different number of hands. What was my wife's answer?

Let’s start with the person who shook eight hands. All others (including myself and excluding that person’s spouse) shook at least that person's hand, so everyone else shook at least one hand. Therefore, that person’s spouse must be the person who shook zero hands. That's the tricky part. Now, take the couple who shook eight and zero hands out of the equation. To do so, subtract one from the answers of all remaining individuals. Simply imagine that you’re now facing the same puzzle, but with four couples, and with the seven individuals besides me replying to my question with the answers 0 through 6.

You'll quickly conclue that the five couples, including me and my wife, shook hands in the following manner: 8/0, 7/1, 6/2, 5/3, 4/4. Because I asked nine individuals how many hands they shook, and I got nine unique answers, my wife and I must be the couple who shook four hands each. Hence, my wife shook four hands.

November's Puzzle: Then There Were Five?
I got this puzzle from my good friend Dejan Sarka. It involves a mix of logic and English. Can you think of a sentence that contains the word "and" five times consecutively ("and and and and and")? The sentence must make sense. In other words, I'm not aiming for a sentence such as "Five times 'and' are and and and and and." Rather, the sentence should make sense without such silly tricks.



ARTICLE TOOLS

Comments
  • Srinivas
    6 years ago
    Nov 14, 2006

    youandme is one word, there are no spaces between "you" and "and" and "and" and "me"

  • KALEN
    6 years ago
    Nov 12, 2006

    In response to jclaggett- November 02, 2006

    I was the person who had to Tech Review this problem for SQL Magazine, and I must admit it took me quite a while to understand and believe this solution. But I finally got convinced (with help from my genius 18-year old son). I think the misunderstanding you are having is that when Itzik says "Each person shook a different number of hands" he means "Each person THAT HE ASKED shook a different number of hands", meaning he is not including himself. He did not have to ask himself anything.

    (And the rating list does look screwy)

    -- Kalen Delaney

  • Gustavo
    6 years ago
    Nov 10, 2006

    1 + 1 = 2
    Then 3
    3 +1 = 4
    then 5

    If my logic is correct I rate your article with a value of 4.

  • Jody
    6 years ago
    Nov 02, 2006

    Um. Your puzzle states that "Each person shook a different number of hands." Yet your solution says that both you and your wife shook four hands. Am I missing something? And when I rated this article, my options were "1, 1, 3, 1 and 5". Um?

You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...