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.
Comp. Sc: Reverse the words
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?
Labels: Easy Puzzles
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?
Labels: Easy Puzzles, Puzzles: at Interview
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?
Labels: Easy Puzzles, Puzzles: at Interview
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.
Labels: Puzzles: at Interview
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?
Labels: Easy Puzzles, Puzzles: at Interview
Easy: hour glasses
You have two hourglasses: a 7 minute one and an 11 minute one. Using just these hourglasses, accurately time 15 minutes.
Labels: Easy Puzzles, Puzzles: at Interview
Easy: Glass Half Full
How do you ensure that the glass is half full
Labels: Easy Puzzles, Puzzles: at Interview
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.
Labels: Puzzles: Math.