Long math riddles

logicmathclever

Sam has got three daughters. The eldest daughter is the most honest girl in the universe and she always speaks truth. The middle daughter is a modest woman. She speaks truth and lies according to the situations. The youngest one never speaks truth. Not a single word she spoke was true and would never be true. Sam brought a marriage proposal for one of his girls. It was John. John wanted to marry either the eldest or the youngest daughter of Sam as he can easily identify whether the girl speaks truth or lie! John told his desire to Sam. However, Sam laid a condition. He told John that he will not say who the eldest, middle or youngest one is. Also, he allowed John to ask only one question to identify the eldest or youngest so he can marry one. John asked one question and found the right girl. What was the question and whom should he pick?
The question he asked is, 'Is she older than her?' He asks this question to one of the daughters. If he asked this question to older daughter pointing at other two, he probably would know the youngest one! NO matter, she always speaks truth. If he asked the question to middle one, probably he can choose either. If he asked the youngest one, she always lies and he can find eldest one. No matter, he has to choose the youngest one based on the answer.
68.38 %
56 votes
logicmath

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
68.01 %
59 votes
logicmathtricky

A train leaves from Halifax, Nova Scotia heading towards Vancouver, British Columbia at 120 km/h. Three hours later, a train leaves Vancouver heading towards Halifax at 180 km/h. Assume there's exactly 6000 kilometers between Vancouver and Halifax. When they meet, which train is closer to Halifax?
Both trains would be at the same spot when they meet therefore they are both equally close to Halifax.
67.98 %
88 votes
logicmathsimpleclean

In a new Engineering Hostels they have 100 rooms. Ankit Garg was hired to paint the numbers 1 to 100 on the doors. How many times will Ankit have to paint the number eight ?
20 times. (8, 18, 28, 38, 48, 58, 68, 78, 98, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89)
67.57 %
69 votes
logicmathclever

A deliveryman comes to a house to drop off a package. He asks the woman who lives there how many children she has. "Three," she says. "And I bet you can't guess their ages." "Ok, give me a hint," the deliveryman says. "Well, if you multiply their ages together, you get 36," she says. "And if you add their ages together, the sum is equal to our house number." The deliveryman looks at the house number nailed to the front of her house. "I need another hint," he says. The woman thinks for a moment. "My youngest son will have a lot to learn from his older brothers," she says. The deliveryman's eyes light up and he tells her the ages of her three children. What are their ages?
Their ages are 1, 6, and 6. We can figure this out as follows: Given that their ages multiply out to 36, the possible ages for the children are: 1, 1, 36 (sum = 38) 1, 2, 18 (sum = 21) 1, 3, 12 (sum = 16) 1, 4, 9 (sum = 14) 1, 6, 6 (sum = 13) 2, 2, 9 (sum = 13) 2, 3, 6 (sum = 11) 3, 3, 4 (sum = 10) When the woman tells the deliveryman that the children's ages add up to her street number, he still doesn't know their ages. The only way this could happen is that there is more than one possible way for the children's ages to add up to the number on the house (or else he would have known their ages when he looked at the house number). Looking back at the possible values for the children's ages, you can see that there is only one situation in which there are multiple possible values for the children's ages that add up to the same sum, and that is if their ages are either 1, 6, and 6 (sums up to 13), or 2, 2, and 9 (also sums up to 13). So these are now the only possible values for their ages. When the woman then tells him that her youngest son has two older brothers (who we can tell are clearly a number of years older), the only possible situation is that their ages are 1, 6, and 6.
65.70 %
95 votes
logicmath

You have two sand hourglasses, one that measures exactly 4 minutes and one that measures exactly 7 minutes. You need to measure out exactly 2 minutes to boil an egg. Using only these two hourglasses, how can you measure out exactly 2 minutes to boil your egg?
Flip over both hourglasses at the same time. 1. After 4 minutes, the 4-minute hourglass will be done, and there will be 3 minutes left in the 7-minute hourglass. Immediately flip the 4-minute hourglass over again. 2. After 3 more minutes, the 7-minute hourglass will be done, and there will be exactly 1 minute left in the 4-minute hourglass. Immediately flip the 7-minute hourglass over again. 3. After 1 more minute, the 4-minute hourglass will be done again, and there will be exactly 6 minutes left in the 7-minute hourglass. Immediately flip over the 4-minute hourglass. 4. After 4 more minutes, the 4-minute hourglass will be done again, and there will be exactly 2 minutes left in the 7-minute hourglass. At this point, put your egg in the boiling water. When the 7-minute hourglass is done, it will have been exactly 2 more minutes, and your egg will have boiled just right. Or after step 2 just flip 7-minute hourglass for second minute.
64.60 %
136 votes
logicmath

There is a box full of marbles, all but two are blue, all but two are green, and all but two are red. How many marbles are in the box?
There are 3 marbles (1 blue, 1 green, and 1 red).
63.13 %
163 votes
logicmathcleansimple

In a supermarket, the first 25 customers of the day purchased an average of two items each. After a further 15 customers, the average number of items purchased by each customer rose to eight. What was the average number of items purchased by the last 15 customers only?
((15+25) x 8 - (25 x 2))/15 = 18
62.91 %
47 votes
logicmathstorymystery

A witch owns a field containing many gold mines. She hires one man at a time to mine this gold for her. She promises 10% of what a man mines in a day, and he gives her the rest. Because she is blind, she has three magic bags who can talk. They report how much gold they held each day, and this is how she finds out if men are cheating her. Upon getting the job, each man agrees that if he isn't honest, then he will be turned into stone. So around the witch's mines, many statues lay! Now comes an honest man named Garry. He accepts the job gladly. The witch, who didn't trust him said, "If I wrongly accuse you of cheating me, then I'll be turned into stone." That night, Garry, having honestly done his first day's job, overheard the bags talking to the witch. He then formulated a plan... The next night, he submitted his gold, and kept 1.6 pounds of gold. Later, the witch talked with her bags. The first bag said it held 16 pounds that day. The second one said it held 5 pounds. The third one said it held 2 pounds. Beaming, the witch confronted Garry. "You scoundrel, you think you could fool me. Now you shall turn into stone!" the witch cried. One second later, the witch was hard as a rock, and very grey-looking. How did Garry brilliantly deceive the witch?
Garry put 2 lbs. in bag #1. 3 lbs. were put in bag #2. 11 lb. were put into bag #3. He then put bag #2 into bag #3, and bag #1 into bag #2. The bags only felt the weight of the gold above it. Thus they inadvertently gave the message that 23 lbs. were taken.
62.73 %
167 votes
logicmathclever

You and a friend are standing in front of two houses. In each house lives a family with two children. "The family on the left has a boy who loves history, but their other child prefers math," your friend tells you. "The family on the right has a 7-year old boy, and they just had a new baby," he explains. "Does either family have a girl?" you ask. "I'm not sure," your friend says. "But pick the family that you think is more likely to have a girl. If they do have a girl, I'll give you $100." Which family should you pick, or does it not matter?
You should pick the house on the left. Specifically, there is a 2/3 chance that the family on the left has a girl, whereas there's only a 1/2 chance that the house on the right has a girl. This is a very counterintuitive riddle. It seems like there should always be a 1/2 chance that a given child is a girl. And in fact there is. The key word there is "given". Because we are not asking about a "given" child for the house on the left. We are asking about what could be either child. Whereas for the house on the right, we are asking about a "given" child...specifically, we're asking about the younger child. There are 3 possibilities for the children in the first house: Younger Older Girl Boy Boy Girl Boy Boy There is no "Girl, Girl" option because we know the house on the left has at least one boy. Since each of these 3 options is equally likely, and 2 of them have one girl, there is a 2/3 chance of there being a girl in the house on the left. For the house on the right, because we already know the older child is a boy, there are only two possibilities: Younger Older Girl Boy Boy Boy And as we can see, there is a 1/2 chance for the house on the right having a girl. Search for: Boy or Girl paradox
61.91 %
67 votes