Tom's height is six feet, he is an assistant at a butcher's shop, and wears size 12 shoes. What does he weigh?
See also best riddles or new riddles.logic
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.logicshort
Tommy Tucker took two strings and tied two turtles to two tall trees. How many T’s in that?
There are 2 t’s in THAT.logicmath
How can you divide a pizza into 8 equal slices using only 3 straight cuts?
Cut 1: Cut the pizza straight down the middle into two halves.
Cut 2: Keeping the two halves in the place, cut the pizza straight down the middle at right angles to the first cut (you will be left with 4 equal quarters)
Cut 3: Pile the 4 quarters on top of each other and cut through the middle of the pile. You will be left with 8 equal slices.logicshort
A man had a book that was worth $40,000. There were only 2 books in existence. He threw it in the furnace, reducing it to a pile of soot. Why did he do this?
He destroyed the book because he has two, and by only having one, the value goes up.logicprobability
Hussey has been caught stealing goats, and is brought into court for justice. The judge is his ex-wife Amy Hussey, who wants to show him some sympathy, but the law clearly calls for two shots to be taken at Hussey from close range.
To make things a little better for Hussey, Amy Hussey tells him she will place two bullets into a six-chambered revolver in successive order. She will spin the chamber, close it, and take one shot.
If Hussey is still alive, she will then either take another shot, or spin the chamber again before shooting. Hussey is a bit incredulous that his own ex-wife would carry out the punishment, and a bit sad that she was always such a rule follower.
He steels himself as Amy Hussey loads the chambers, spins the revolver, and pulls the trigger. Whew! It was blank. Then Amy Hussey asks, 'Do you want me to pull the trigger again, or should I spin the chamber a second time before pulling the trigger?'
What should Hussey choose?
Hussey should have Amy Hussey pull the trigger again without spinning.
We know that the first chamber Amy Hussey fired was one of the four empty chambers. Since the bullets were placed in consecutive order, one of the empty chambers is followed by a bullet, and the other three empty chambers are followed by another empty chamber. So if Hussey has Amy Hussey pull the trigger again, the probability that a bullet will be fired is 1/4.
If Amy Hussey spins the chamber again, the probability that she shoots Hussey would be 2/6, or 1/3, since there are two possible bullets that would be in firing position out of the six possible chambers that would be in position.funnylogic
A murdered is condemned to death. He has to choose between three rooms. The first is full of raging fires, the second is full of assassins with loaded guns, and the third is full of lions that haven't eaten in 3 years. Which room is safest for him?
The third room. Lions that haven't eaten in three years are dead.funnylogicmath
An infinite number of mathematicians are standing behind a bar. The first asks the barman for half a pint of beer, the second for a quarter pint, the third an eighth, and so on. How many pints of beer will the barman need to fulfill all mathematicians' wishes?
A clerk in the butcher shop is 5 feet, 10 inches tall. What does he weigh?
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)
for each character in S1
arrayIndex = mapCharacterToNumber(character) //maps "a" to 0, "b" to 1, "c" to 2, etc...
A[arrayIndex] += 1
for each character in S2
arrayIndex = mapCharacterToNumber(character)
A[arrayIndex] -= 1
for (i = 0; i < 26; i++)
if A[i] != 0
There are 5 ships in a port.
The Greek ship leaves at six and carries coffee.
The ship in the middle has a black chimney.
The English ship leaves at nine.
The French ship with a blue chimney is to the left of a ship that carries coffee.
To the right of the ship carrying cocoa is a ship going to Marseille.
The Brazilian ship is heading for Manila.
Next to the ship carrying rice is a ship with a green chimney.
A ship going to Genoa leaves at five.
The Spanish ship leaves at seven and is to the right of the ship going to Marseille.
The ship with a red chimney goes to Hamburg.
Next to the ship leaving at seven is a ship with a white chimney.
The ship on the border carries corn.
The ship with a black chimney leaves at eight.
The ship carrying corn is anchored next to the ship carrying rice.
The ship to Hamburg leaves at six.
Which ship goes to Port Said? Which ship carries tea?
The French ship.