## Barber

A sign on the barber's door says "I shave only those who do not shave themselves." Does the barber shave himself?

There is no answer, it's a paradox. It cannot be made to work.

A sign on the barber's door says "I shave only those who do not shave themselves." Does the barber shave himself?

There is no answer, it's a paradox. It cannot be made to work.

See also best riddles or new riddles.

A king decided to let a prisoner try to escape the prison with his life. The king placed 2 marbles in a jar that was glued to a table. One of the marbles was supposed to be black, and one was supposed to be blue. If the prisoner could pick the blue marble, he would escape the prison with his life. If he picked the black marble, he would be executed. However, the king was very mean, and he wickedly placed 2 black marbles in the jars and no blue marbles. The prisoner witnessed the king only putting 2 black marbles in the jars. If the jar was not see-through and the jar was glued to the table and that the prisoner was mute so he could not say anything, how did he escape with his life?

The prisoner grabbed one of the marbles from the jar and concealed it in his hand. He then swallowed it, and picked up the other marble and showed everyone. The marble was black, and since the other marble was swallowed, it was assumed to be the blue one. So the mean king had to set him free.

The day before yesterday Cindy was 17. Next year she will be 20. How can this be?

The statement was made on January 1. Cindy's birthday is on December 31. She was 17 the day before yesterday (Dec 30). She was 18 yesterday. She will be 19 this year (Dec 31) and 20 next year.

How much dirt would be in a hole 6 feet deep and 6 feet wide that has been dug with a square edged shovel?

None.
No matter how big a hole is, it's still a hole: the absence of dirt.
And those of you who said 36 cubic feet are wrong for another reason, too.
You would have needed the length measurement too.
So you don't even know how much air is in the hole.

Using only and all the numbers 3, 3, 7, 7, along with the arithmetic operations +,-,*, and /, can you come up with a calculation that gives the number 24? No decimal points allowed.
[For example, to get the number 14, we could do 3 * (7 - (7 / 3))]

7 * ((3 / 7) + 3) = 24

A clock chimes 5 times in 4 seconds. How many times will it chime in 10 seconds?

11 times. It chimes at zero and then once every second for 10 seconds.

Elmer Johnson went to the hardware store to make a purchase for his house. He asked the store clerk, "How much will one cost?" The clerk thought for a moment and said, "Three dollars." Elmer Johnson, who looked a little puzzled said, "Well then, how much will twelve cost?" "Six dollars," replied the clerk. Elmer Johnson scratched his head and said, "If I were to purchase two hundred, how much would that cost?" "That," said the clerk, "will cost you nine dollars." What was Elmer Johnson buying?

He was buying house numbers.

Two words are anagrams if and only if they contain the exact same letters with the exact same frequency (for example, "name" and "mean" are anagrams, but "red" and "deer" are not).
Given two strings S1 and S2, which each only contain the lowercase letters a through z, write a program to determine if S1 and S2 are anagrams. The program must have a running time of O(n + m), where n and m are the lengths of S1 and S2, respectively, and it must have O(1) (constant) space usage.

First create an array A of length 26, representing the counts of each letter of the alphabet, with each value initialized to 0. Iterate through each character in S1 and add 1 to the corresponding entry in A. Once this iteration is complete, A will contain the counts for the letters in S1. Then, iterate through each character in S2, and subtract 1 from each corresponding entry in A. Now, if the each entry in A is 0, then S1 and S2 are anagrams; otherwise, S1 and S2 aren't anagrams.
Here is pseudocode for the procedure that was described:
def areAnagrams(S1, S2)
A = new Array(26)
A.initializeValues(0)
for each character in S1
arrayIndex = mapCharacterToNumber(character) //maps "a" to 0, "b" to 1, "c" to 2, etc...
A[arrayIndex] += 1
end
for each character in S2
arrayIndex = mapCharacterToNumber(character)
A[arrayIndex] -= 1
end
for (i = 0; i < 26; i++)
if A[i] != 0
return false
end
end
return true
end

A man lives on the 44th floor of his building. On rainy days, when he gets home from work, he takes the elevator all the way up to his floor. But on sunny days, he goes up to floor 20 and walks the rest of the way. Why does he do this?

The man is a midget and cannot reach button "44" in the elevator on sunny days. On rainy days he has his umbrella with him and is able to use it to press the button.

Six glasses are in a row. The first three are filled with milk and the last three are empty. By moving only one glass, can you arrange them so that the full and the empty glasses alternate?

Sally and her younger brother were fighting. Their mother was tired of the fighting, and decided to punish them by making them stand on the same piece of newspaper in such a way that they couldn't touch each other. How did she accomplish this?

Sally's mother slid a newspaper under a door and made Sally stand on one side of the door and her brother on the other.