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?

Children

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)

Measuring

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)

Monday, September 22, 2008

Seeds

Here's a non-logical thinking riddle from my roommate: Name a fruit that has seeds on the OUTSIDE.

How old are the daughters?

So a new family moved into a house and a neighbor decided to be friendly and come greet them. They started talking and the husband of the family mentioned that he had three daughters.

The neighbor asked him how old his daughters were and the husband replied "Well, the product of their three ages is 36 and the sum of their ages is the same as my house number."

After a little while, the neighbor looked at the husband and said "I can not determine the ages of your daughters with that information. I still need more."

The husband said "Ok, the eldest daughter's favorite ice cream is strawberry."

Afterwards the neighbor replied "Ah! I got the ages of the daughters."

What are the ages of the daughters?
(there enough information given in the story to find the solution, trust me ;)

Optics and Einstein

My friend and I were trying to figure this one out. Try it out. Here's the link:
http://riddles.com/all-kinds-of-riddles/riddles/where-does-the-extra-man-come-from-?-2008080566524/


Also here's a good riddle by Einstein:
(taken from http://www.manbottle.com/trivia/einstein_s_riddle)
==================

Einstein's Riddle

ALBERT EINSTEIN'S RIDDLE

ARE YOU IN THE TOP 2% OF INTELLIGENT PEOPLE IN THE WORLD? SOLVE THE RIDDLE AND FIND OUT.

There are no tricks, just pure logic, so good luck and don't give up.

1. In a street there are five houses, painted five different colours.
2. In each house lives a person of different nationality
3. These five homeowners each drink a different kind of beverage, smoke different brand of cigar and keep a different pet.

THE QUESTION: WHO OWNS THE FISH?

HINTS

1. The Brit lives in a red house.
2. The Swede keeps dogs as pets.
3. The Dane drinks tea.
4. The Green house is next to, and on the left of the White house.
5. The owner of the Green house drinks coffee.
6. The person who smokes Pall Mall rears birds.
7. The owner of the Yellow house smokes Dunhill.
8. The man living in the centre house drinks milk.
9. The Norwegian lives in the first house.
10. The man who smokes Blends lives next to the one who keeps cats.
11. The man who keeps horses lives next to the man who smokes Dunhill.
12. The man who smokes Blue Master drinks beer.
13. The German smokes Prince.
14. The Norwegian lives next to the blue house.
15. The man who smokes Blends has a neighbour who drinks water.

ALBERT EINSTEIN WROTE THIS RIDDLE EARLY DURING THE 19th CENTURY. HE SAID THAT 98% OF THE WORLD POPULATION WOULD NOT BE ABLE TO SOLVE IT.

Wednesday, September 10, 2008

Google Interview Question

If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? (The answer to this is not zero!)

Playing with Balls

You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

What comes next?


Can you figure out what the "?" should be? ;)

Light Bulb Action

You're upstairs in a room that contains 3 switches. One of these switches controls the one light bulb downstairs while the other two do not. You only have one chance to go downstairs and check the light bulb at any time. How do you determine which switch controls the light bulb?

Friday, August 15, 2008

101 List

You have an array of 101 elements.
The array contains the numbers 1,2,3,4,5,...,100 but it is not in order.
ONE of those numbers is repeated in this array (which explains the 101th element).
Your job is to determine what number is repeated with only ONE traversal of the array.

How will you do this?

Heart of Glass

So you have a perfectly cylindrical glass of water as shown:


How would you measure exactly 1/2 of this glass of water without using ANY tools whatsoever? The only thing you have is this glass...

and maybe more water if you fail...

at life.....

Hat Riddle III

The king is searching for an heir to the throne so he of course wants to find the wisest of wise to become his next successor. The king tells his servant to summon the 3 most wisest men in the country to his throne room and there he gives them a test to see who is capable of being the next king.

The king says "Here with me are 3 hats. Each of the hats MAY or MAY NOT have a dot on it but at least one hat will have a dot on it for sure. You will put on these hats and then if you are able to tell me with certainty whether your hat has a dot or not, then you will become the next king."

The king secretly tells his servant to put a dot on ALL of the hats. The servant does so and then the hats are placed on each of the men's heads. The men are situated in a position where they can all see each other but they can't see their own hat.

After a while, one of the men walks up to the king and says "I know for sure that I have a dot on my hat."

How does he know?

Hat Riddle II

It's nearly New Years and there are 3 guys in jail serving out their sentences. Our Jail Master, let's call him JM Dave (:P), has decided to be nice to these prisoners and give them a chance to be set free, because after all, it IS New Years soon.

JM Dave tells them that if they can solve this riddle, they will all be set free. However if not, they will serve the remainder of their sentence in jail.

JM Dave takes out 5 hats.
3 Hats are white.
2 Hats are black.

He gets behind the 3 prisoners and then puts a hat on each of their heads and hides the other 2 hats. The prisoners are then situated so that they can all see each other but they can't see their own hat like shown:

JM Dave then says "if any of you can guess the color of your own hat correctly, you'll be set free. If not then you will have to serve out the remainder of your sentence."

JM Dave goes to person A and asks "Can you tell me the color of your own hat correctly?"
Person A looks at B and looks at C and then says "No."
JM Dave says "That's unfortunate, you're going to have to serve the remainder of your sentence here."

JM Dave goes to B and asks the same question.
Person B looks at person A and person C and says "No. I can't tell the color of my own hat."
JM Dave then says "That is unfortunate. It seems like all three of you will have to serve out your remaining sentences."

Person C interrupts and exclaims "Wait! You didn't even ask me yet!"
JM Dave responds "Well, that is because you are totally blind so there was no point in asking you."
Person C states "I may be blind, but I know the color of my own hat FOR SURE."

What color is Person C's hat and how does he know for sure?

Hat Riddle I

There's a serial killer who kidnaps 3 men. The killer buries the men in the ground up to their necks so that they can't move around. The men are buried in a position so that they're all facing the same direction and also one behind another, but not directly behind, as shown:

Person C can see person B and A.
Person B can only see person A.
Person A can't see any of the other two.
The killer can see all of them but none of them can see the killer.

The killer then takes out 4 hats.
2 Hats are black.
2 Hats are white.

The killer puts a hat on each of the person's head and then the last hat on himself. He then tells the three guys that if any ONE of them can correctly guess the color of his OWN hat, they will ALL be set free. However, the FIRST word out of ANY of their mouths, has to be the correct color of his own hat. If not, all of them will die. Because of this, the 3 guys can not collaborate or discuss how to solve this riddle.

There is a 100% sure way to figure out the correct color but how do they do it?

Hello

Many of you may know me in person. I like to solve riddles when we're out at lunch with a group of friends sometime or when we're on long road trips. This blog will be a compilation of the riddles that I've heard and I want to store for future sharing. :)