The Pope, Beyonce, Barack Obama, and Bill Gates are on the same plane. There are only 3 parachutes left for the 4 of them. Obama says: "As the President, I think I should have the right to have a parachute, because I rule millions of people in the greatest nation of all." Beyonce says: "As one of the greatest singers of all-time, I think I should deserve to be safe. I bring tears and laughter to millions of people, and I'm an important contributor to pop music." Bill Gates says: "As one of the richest successful company owners, I think I should live because I'm on top of the economics cycle, creating jobs and incomes for millions of people. I am a wealthy and intelligent man." Finally, the Pope says: "I'm an old, religious man. I lived a life that's full, I helped millions of people find their way through God, I'm ready to let go of a parachute and to face my fate." Which one of them will abandon the parachute and die?
Did I ever mention that the plane was crashing? No one's gonna die.
See also best riddles or new riddles.logicshortwhat am I
A word I know,
Six letters it contains,
Subtract just one,
And twelve is what remains.
Dozens.cleanlogicshortwhat am I
Give me food, and I will live. Give me water, and I will die. What am I?
If you had a pizza with crust thickness 'a' and radius 'z', what's the volume of the pizza?
pi * z * z * alogicshort
If a farmer has 5 haystacks in one field and 4 haystacks in the other field, how many haystacks would he have if he combined them all in the center field?
One. If he combines all of his haystacks, they all become one big stack.animalfunnylogicshort
If 20 blackbirds are on a fence and you shoot one, how many remain?
None, they would all fly away from the sound of the shot.cleanfunnylogicpoemsshort
Thirty white horses on a red hill.
First they champ,
Then they stamp,
Then they stand still.
Who are they?
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
On the game show et´s Make a Deal, Monty Hall shows you three doors. Behind one of the doors is a new car, the other two hide goats. You choose one door, perhaps #1. Now Monty shows you what´s behind door #2 and it´s a goat.He gives you the chance to stay with original pick or select door #3. What do you do?
You should always abandon your original choice in favor of the remaining door (#3). When you make your first choice the chance of winning is 1 in 3 or 33%. When you switch doors, you turn a 2 in 3 chance of losing in the first round into a 2 in 3 chance of winning in the second round. logic
Jay escaped from jail and headed to the country. While walking along a rural road, he saw a police car speeding towards him. Jay ran toward it for a short time and then fled into the woods. Why did he run toward the car?
Jay was just starting to cross a bridge when he saw a police car. He ran toward the car to get off the bridge before running into the woods. logic
Handel has been killed and Beethoven is on the case. He has interviewed the four suspects and their statements are shown below. Each suspect has said two sentences. One sentence of each suspect is a lie and one sentence is the truth. Help Beethoven figure out who the killer is.
Joplin: I did not kill Handel. Either Grieg is the killer or none of us is.
Grieg: I did not kill Handel. Gershwin is the killer.
Strauss: I did not kill Handel. Grieg is lying when he says Gershwin is the killer.
Gershwin: I did not kill Handel. If Joplin did not kill him, then Grieg did.
Who is the killer?
Strauss is the one who killed Handel. You need to take turns assuming someone is the killer; that means everyone's second sentence is a lie. If Joplin was the killer, Grieg's lie mixed with Strauss' counteracts the other. If Grieg was the killer, Gershwin would need to be a killer too. If Gershwin was the killer, Gershwin would need to be a killer too. If Gershwin was the killer, Grieg and Strauss counter each other again, but with Strauss, everything would fit in.