Comp. Sc: Reverse the words

Write a General Algorithm for "Reverse the words in a sentence",
Example: "My name is Chris" becomes "Chris is name My."
Try to optimize interms of Time/space.

Easy: Beggar

There is a beggar who can make a new cigarette from 4 cigarette buds. One morning he collects 32 buds on the street, how many cigarettes can he smoke that day?

Easy: Head/Tail

Some coins scattered on table, with equal number of Heads and Tails... you need to split the bunch into two sets such that each set contain equal number of Heads......
It seems silly right...

Now the trickey part is "think that u r a bliend person" and go on?

Easy: Two Girlfriends

Bill has two girlfriends, Hillary and Monica. Monica lives in the East of a city, and Hillary lives in the West of the same city, as shown in the figure below. Once every morning at a random time, Bill arrives at the train station at the center of the city. A train leaves for the East every 10 minutes, and a train leaves for the West every 10 minutes — Bill chooses whichever train arrives first. On average, could Bill end up with one girl more often than the other? If so, how many times more often? Why?

MS-Interview: chain hump

You have a 6-foot long chain that is suspended at its ends, tacked to a wall. The tacks are parallel to the floor. Due to gravity, the middle part of the chain hangs down a little bit, forming a hump; the length of this hump in the vertical direction is 3 feet. Find the distance in between the tacks.

Math: chain links

What is the least number of links you can cut in a chain of 21 links to be able to give someone all possible number of links up to 21?

Easy: 3-hats

There are 3 black hats and 2 white hats in a box. Three men (we will call them A, B, & C) each reach into the box and place one of the hats on his own head. They cannot see what color hat they have chosen. The men are situated in a way that A can see the hats on B & C's heads, B can only see the hat on C's head and C cannot see any hats. When A is asked if he knows the color of the hat he is wearing, he says no. When B is asked if he knows the color of the hat he is wearing he says no. When C is asked if he knows the color of the hat he is wearing he says yes and he is correct. What color hat and how can this be?

Easy: hour glasses

You have two hourglasses: a 7 minute one and an 11 minute one. Using just these hourglasses, accurately time 15 minutes.

Easy: Glass Half Full

How do you ensure that the glass is half full

Math: Find non-repeating no

Given an array of integers where each number occurs twice except two which occur only once each. Find both non-repeating numbers in O(n) time using O(1) space.

Math: Prove it -- puzzle

Show that the sum of consecutive primes is never twice a prime.