Tuesday, March 17, 2009

On the River

So it's been a while since I've posted up anything on this blog. It's because I haven't really been in the riddles phase and none of my coworkers or friends do it.

Anyways I just got this flash page from my friend that has a riddle consisting of trying to get a group of people to cross the river. If you can't read Chinese, then here are the rules:

The man can't be on the same shore with the little girls unless the woman is there.
The woman can't be on the same shore with the little boys unless the man is there.
The Prisoner can't be on the same shore with anyone unless the police is there.

Only two people are allowed on the raft at a time.

Click on a person to send them on/off the raft. Click on the lever to move them across.
Kids can not operate the raft, only the police and the adults can.

Click on the big blue circle to start the game.


Friday, October 3, 2008

Pocket Change

You and a friend pass by a standard coin operated vending machine and you decide to get a candy bar. The price is US$0.95 but after checking your pockets you only have a dollar (US$1) and the machine only takes coins.

You turn to your friend and have this conversation.

You: Hey, do you have change for a dollar?
Friend: Let's see... I have 6 US coins but, although they add up to US$1.15, I can't break a dollar.
You: Huh? Can you make change for half a dollar?
Friend: No.
You: How about a quarter?
Friend: Nope. And before you ask I can't make change for a dime or nickel either.
You: Really? And these 6 coins are all US government coins currently in production?
Friend: Yes.
You: Well can you just put your coins into the vending machine and buy me the candy bar, and I'll pay you back?
Friend: Sorry, I'd like to but I can't with the coins I have.
What coins does your friend have?

Missing $1

My friend Sony told me this riddle back in Middle School:

So three monks are traveling home when it starts to rain. Seeing this, they stop by the nearest hotel and check in. The room rate is $30 for one night for all three of them so the monks split the cost three-way and pay $10 each.
The manager later finds out that the three who checked into the hotel are monks and decides to give them a discount. The manager takes $5 and tells the bellboy to go give the monks back some of their money. The bellboy decides to pocket $2 of the $5 and gives $1 to the each of the monks.

So here's the problem:
Technically the monks all paid $9 each for their room. The bellboy pocketed $2 which totals up to $29. What happened to the last dollar?

Programming: Swapping Variables

Here's a pretty simple programming problem:

Let A equal some integer and B equal some different integer. How can you swap these variables without using a temporary variable?

The Monty Hall Problem

I read this in the book

The Curious Incident of the Dog in the Night-Time

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?


One of my co-interns gave me this riddle a few years back:

So there's a family with two kids.
One of the kids is a girl. What is the probability that the other kid is girl?
(It's not 1/2)


An easy riddle Robert reminded me of during a midnight-ish snack at Yechon.

So you have two buckets, one measures 3 liters and one measures 5 liters. How can you use these two buckets to measure exactly 4 liters of water?
(You have infinite water supply)