PART B: LOGICAL PUZZLES
Puzzle 1: The Two Doors (Truth-Teller & Liar)โ
Problem: You're in a room with two doors โ one leads to freedom, the other to death. There are two guards: one always tells the truth, the other always lies. You can ask ONE question to ONE guard. What do you ask?
Solution:
Ask either guard: "If I asked the OTHER guard which door leads to freedom, what would they say?"
Then choose the opposite door.
Why it works:
- If you ask the truth-teller โ He truthfully reports the liar's lie โ Wrong door
- If you ask the liar โ He lies about the truth-teller's truth โ Wrong door
- Either way, you get the WRONG door โ so choose the other one โ
๐ง Double-negation trick: Truth about a lie = wrong. Lie about truth = wrong. Both paths give the wrong answer โ flip it.
Puzzle 2: The 8 Balls Problem (Classic Weighing Puzzle)โ
Problem: You have 8 identical-looking balls. One is heavier than the rest. You have a balance scale. Find the heavy ball in the minimum number of weighings.
Solution: 2 weighings
Weighing 1: Put 3 balls on each side, keep 2 aside.
| Result | What It Means |
|---|---|
| Left side heavier | Heavy ball is in the left group of 3 |
| Right side heavier | Heavy ball is in the right group of 3 |
| Balanced | Heavy ball is in the 2 set aside |
Weighing 2:
- If you identified a group of 3: Put 1 on each side, keep 1 aside. Same logic โ you'll find the heavy one.
- If it was in the pair: Put 1 on each side. Heavier one is the answer.
Key Insight: Each weighing gives 3 outcomes (left heavy, right heavy, balanced). With 2 weighings โ 3ยฒ = 9 possible outcomes, which covers 8 balls.
Puzzle 3: The River Crossing (Farmer, Fox, Chicken, Grain)โ
Problem: A farmer needs to cross a river with a fox, a chicken, and a bag of grain. The boat fits only the farmer + one item. If left alone: the fox eats the chicken, or the chicken eats the grain. How does the farmer get everything across?
Solution:
| Trip | Action | Left Bank | Right Bank |
|---|---|---|---|
| 1 | Take chicken across | Fox, Grain | Chicken |
| 2 | Return alone | Fox, Grain | Chicken |
| 3 | Take fox across | Grain | Fox, Chicken |
| 4 | Bring chicken back | Chicken, Grain | Fox |
| 5 | Take grain across | Chicken | Fox, Grain |
| 6 | Return alone | Chicken | Fox, Grain |
| 7 | Take chicken across | โ | Fox, Grain, Chicken โ |
Key Insight: The trick is bringing the chicken BACK on trip 4. Most people don't consider taking something back.
Puzzle 4: The Burning Rope Timerโ
Problem: You have two ropes. Each takes exactly 60 minutes to burn completely, but they burn unevenly (some parts faster, some slower). How do you measure exactly 45 minutes?
Solution:
- At t=0: Light Rope A from BOTH ends + Light Rope B from ONE end
- Rope A burns completely in 30 minutes (because both ends are burning toward the middle)
- At t=30: The moment Rope A finishes, light the other end of Rope B
- Rope B has 30 minutes of burn remaining, but now it's burning from both ends โ finishes in 15 minutes
- Total: 30 + 15 = 45 minutes โ
Puzzle 5: The Light Bulb Problemโ
Problem: You're outside a closed room with 3 light switches. Inside the room, there are 3 bulbs. You can flip switches as many times as you want, but you can enter the room only ONCE. How do you determine which switch controls which bulb?
Solution:
- Turn Switch 1 ON for 10 minutes
- Turn Switch 1 OFF, turn Switch 2 ON
- Enter the room:
- Bulb ON โ Switch 2
- Bulb OFF but WARM โ Switch 1 (it was on for 10 minutes, now it's warm)
- Bulb OFF and COLD โ Switch 3
Key Insight: Use heat as a second data point. You have 3 states: ON, OFF+warm, OFF+cold.
Puzzle 6: Probability โ The Monty Hall Problemโ
Problem: You're on a game show. There are 3 doors: behind one is a car, behind the other two are goats. You pick Door 1. The host (who knows what's behind the doors) opens Door 3, showing a goat. Should you switch to Door 2 or stay with Door 1?
Solution: Always SWITCH. Switching gives you a 2/3 chance of winning.
Why:
- When you first picked Door 1, probability of car = 1/3
- Probability car is behind Door 2 or 3 = 2/3
- Host ALWAYS opens a goat door. He opened Door 3 (goat), so the entire 2/3 probability shifts to Door 2
- Staying = 1/3 chance. Switching = 2/3 chance.
๐ง Extreme version se samjho: Imagine 100 doors, 1 car. You pick Door 1. Host opens 98 goat doors, leaving your door and Door 57. Would you switch? Obviously yes โ your door had 1% chance, Door 57 now has 99%.
Puzzle 7: The Handshake Problemโ
Problem: At a party of 30 people, everyone shakes hands with everyone else exactly once. How many handshakes occur?
Solution:
Each person shakes hands with 29 others. But each handshake involves 2 people, so we're double-counting.
Handshakes = n(n-1) / 2 = 30 ร 29 / 2 = 435
General Formula: For n people โ n(n-1)/2 handshakes
Puzzle 8: The Missing Numberโ
Problem: You have a list of numbers from 1 to 100. One number is missing. How do you find it in O(1) time?
Solution:
Sum of 1 to 100 = n(n+1)/2 = 100 ร 101 / 2 = 5050
Subtract the sum of your list from 5050 โ the difference is the missing number.
expected_sum = 100 * 101 // 2 # 5050
actual_sum = sum(your_list)
missing = expected_sum - actual_sum
๐ง Data analyst perspective: This is a data integrity check. If your table should have 10,000 sequential IDs and the sum doesn't match n(n+1)/2, you have missing records.
Puzzle 9: The Calendar Puzzleโ
Problem: If January 1st is a Monday, on what day does the 100th day of the year fall?
Solution:
100 days from January 1 (Monday). 100 รท 7 = 14 weeks and 2 days remainder. 14 complete weeks bring us back to Monday. 2 extra days โ Wednesday.
But January 1 is Day 1, not Day 0. So Day 100 = 99 days after Day 1. 99 รท 7 = 14 remainder 1 โ Tuesday
Puzzle 10: Water Jug Problemโ
Problem: You have a 5-litre jug and a 3-litre jug. How do you measure exactly 4 litres?
Solution:
| Step | Action | 5L Jug | 3L Jug |
|---|---|---|---|
| 1 | Fill 5L jug | 5 | 0 |
| 2 | Pour from 5L into 3L | 2 | 3 |
| 3 | Empty 3L jug | 2 | 0 |
| 4 | Pour 2L from 5L into 3L | 0 | 2 |
| 5 | Fill 5L jug again | 5 | 2 |
| 6 | Pour from 5L into 3L (has 1L space left) | 4 | 3 |
Result: 5L jug now has exactly 4 litres โ