Download presentation
Presentation is loading. Please wait.
Published byTodd Foster Modified over 6 years ago
1
Solutions to Puzzles Raghupathy Sivakumar Gatech ECE
2
Puzzle 1 You have a chain consisting of 63 inter-linked gold links
You have to stay at a motel where the charge per day is 1 gold link You do not trust the motel manager and neither does he trust you What is the minimum number of links you need to break in order to stay for 63 days? Clue: The manager will not sell the links till you check out
3
Puzzle 1 Solution 63 1st cut: 1 4 58 2nd cut: 1 4 1 8 49
3rd cut: 1, 2 (=1+1), 4, 8, 16, 32 available!
4
Puzzle 4 Two great mathematicians S & P
S knows the sum of two positive integers (> 1) x and y P knows the product of x and y S calls P and says “You cannot find the two numbers” P replies “I know the two numbers” S responds “I know the two numbers too” What are the two numbers?!!
5
Puzzle 4: (4,13) S says “You cannot find the two nos.”
Constraint 1: The sum cannot be split into two prime numbers or cannot have a unique split 17: (2,15), (3,14), (4,13), (5,12), (6,11), (7,10), (8,9) P says “I have found the two nos.” Constraint 2: For all possible combinations of factors of the product, there is only one combination for which constraint 1 is satisfied 52: (2,26), (4,13) S says “I have found the two nos.” For all possible combinations of splits of the sum, there is only one combination that satisfied Constraint 2
6
Puzzle 6 Man in a boat floating in a swimming pool
He has a large solid iron ball If he drops the ball into the water, what happens to the level of water in the swimming pool? (increases, decreases, stays the same?)
7
Puzzle 6 Man in a boat floating in a swimming pool
He has a large solid iron ball If he drops the ball into the water, what happens to the level of water in the swimming pool? (increases, decreases, stays the same?) Water level drops: When ball is floating (in boat), amount of water displaced is equal to the weight of the ball, whereas when it sinks, the amount of water displaced is equal to the volume of the ball
8
Puzzle 8 In C, what is the output of the following code:
int a[5] = {0,1,2,3,4}; a[2] && printf(“%d %d”, a[3], 3[a]++);
9
Puzzle In C, what is the output of the following code:
int a[5] = {0,1,2,3,4}; a[2] && printf(“%d %d”, a[3], 3[a]++); 4, 3 – on most platforms C language does not stipulate any specific order of parameter processing C parser would just see *(3+a) What if first term were a[0]?
10
Puzzle 15 You have an unfair coin (prob(H) = p != ½)
How will you generate a fair toss?
11
Puzzle 15 You have an unfair coin (prob(H) = p != ½)
Use TH and HT as the two events with equal probability p(1-p). Ignore events TT and HH You have an unfair coin (prob(H) = p != ½) How will you generate a fair toss?
12
Puzzle 18 You have a deck of 52 cards
You draw out 5 cards randomly and look at the cards You can now show 4 of the cards to a friend, and the friend should identify the 5th card How do you do this?
13
Puzzle 18 Let cards be numbered 1-52
Use permutation of the 4 cards to index into the 5th card (how many possible?) Choose cards to avoid having to index a number greater than 24 Eg1: => show appropriately Eg2: => show appropriately You have a deck of 52 cards You draw out 5 cards randomly and look at the cards You can now show 4 of the cards to a friend, and the friend should identify the 5th card How do you do this?
14
Puzzle 22 Two twins A & B A always speaks the truth, and believes all true propositions (say 2+2=4) to be true, and all false propositions (say 2+2=3) to be false B always lies, and believes all true propositions to be false, and all false propositions to be true You meet one of the twins. How many questions do you need to identify which twin he is?
15
Puzzle 22 One question: Are you the truth speaker? Two twins A & B
A always speaks the truth, and believes all true propositions (say 2+2=4) to be true, and all false propositions (say 2+2=3) to be false B always lies, and believes all true propositions to be false, and all false propositions to be true You meet one of the twins. How many questions do you need to identify which twin he is?
16
Puzzle Doors numbered 1-100 All doors initially open
Toggle switch outside every door If switch is pressed, door will close if it is currently open, and open if it is currently closed For i=1 to 100, you press switches of doors that are multiples of i Which doors are closed at the end of the process?
17
Puzzle Doors with odd number of toggles
Doors with odd number of unique factors Doors that have numbers that are perfect Squares! Doors numbered 1-100 All doors initially open Toggle switch outside every door If switch is pressed, door will close if it is currently open, and open if it is currently closed For i=1 to 100, you press switches of doors that are multiples of i Which doors are closed at the end of the process?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.