Skip to main content

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.

ResultWhat It Means
Left side heavierHeavy ball is in the left group of 3
Right side heavierHeavy ball is in the right group of 3
BalancedHeavy 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:

TripActionLeft BankRight Bank
1Take chicken acrossFox, GrainChicken
2Return aloneFox, GrainChicken
3Take fox acrossGrainFox, Chicken
4Bring chicken backChicken, GrainFox
5Take grain acrossChickenFox, Grain
6Return aloneChickenFox, Grain
7Take 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:

  1. At t=0: Light Rope A from BOTH ends + Light Rope B from ONE end
  2. Rope A burns completely in 30 minutes (because both ends are burning toward the middle)
  3. At t=30: The moment Rope A finishes, light the other end of Rope B
  4. Rope B has 30 minutes of burn remaining, but now it's burning from both ends โ†’ finishes in 15 minutes
  5. 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:

  1. Turn Switch 1 ON for 10 minutes
  2. Turn Switch 1 OFF, turn Switch 2 ON
  3. 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:

StepAction5L Jug3L Jug
1Fill 5L jug50
2Pour from 5L into 3L23
3Empty 3L jug20
4Pour 2L from 5L into 3L02
5Fill 5L jug again52
6Pour from 5L into 3L (has 1L space left)43

Result: 5L jug now has exactly 4 litres โœ