Welcome to MindCipher, a social repository of the world's greatest brain teasers, logic puzzles and mental challenges.

Aakash

Comments 30

No if() Only abs()

That's a good point, but I think the idea is to avoid conditionals altogether. Your compiler turns the ternary ( ? : ) operator into the same code that it turns an if statement into (i.e. a conditional branch with two blocks).

context
Random Puzzle

Haha that's kind of clever :)

context
Going to the Track

Solid puzzle. It should be mentioned that, at the London racetrack, you don't actually time each horse. Each time you race 5 horses, you get their relative ranking (who came 1st, 2nd, 3rd, 4th, and 5th) and no other information.

context
12 Identical Balls

I agree with aquaepulse - it's easy to misread the question and think it's a special case.

context
Carpeting a Donut

Love the second explanation, very clever.

context
12 Identical Balls

Though this simplified problem is a good starting point, I think.

context
Balloon Business

These balloon questions always get me.

context
Multiples of 8 plus 1

Whoa, the triangular number sounds surprising..could you explain it with another example? If we have 2 and 3: 2^3 = 8, 3^3 = 27.

In this case, what's our "triangular number ending in k"?

context
Multiples of 8 plus 1

So interesting...I'll check wikipedia out for some proofs.

context
Multiples of 8 plus 1

No worries - solid explanation!

context
Coin Flip

Exactly, I find this arises so often with statistics/probability questions...intuition isn't worth a whole lot. After figuring it out or understanding the solution, you start to wonder how many other things you haven't thought about correctly.

context
The double-square number problem

Very good answer - this seems impossible at first...

context
Sum of Two Prime Numbers

Took me longer than I'd like to admit...very nice though.

context
12 Identical Balls

So much more manageable...this one is tricky and takes some time.

context
Cocktail Party

Interesting approach. Combinatorics also works nicely.

context
3 Coins

That sounds right to me.

context
Coin Flip

Whoa - thanks for sharing!

context
Find the Missing Number

I think Squeamish meant that the first and last numbers in each row have the same number of letters. The rest of it is as Squeamish described.

context
Partitioning a set

Ahh, got it! I think the question is clear, but like this one helps a lot. Thanks, cool question!

context
Partitioning a set

Could you explain why, in your illustration, the answer is 3? Doesn't the question say that all the subsets have to be mutually exclusive (i.e. disjoint)?

Then, with r=4 and k=2, you have only the sets {1,2} and {3,4}. Introducing any of the other sets you mentioned will violate the "disjointness among subsets" requirement. Am I misunderstanding the question?

context
12 Identical Balls

I think this still assumes that you know whether the odd ball is heavier or lighter in advance. The question doesn't appear to give you that assumption.

context
What is the sum of 1+2+3+4+5 . . . (forever)?

The solution seems a little vague - care to explain?

context
Black and White Hats

You're right - I've updated the puzzle :)

context
Black and White Hats

Hey Anand, that scheme won't work. Consider this scenario starting from the back: BWBB...

According to what you've described, the first prisoner (wearing a black hat), will say "white" and be killed. The second prisoner (wearing a white hat) has to say "black" because the two prisoners in front of him are wearing black. Since he is wearing white, he is killed as well. As such, more than just 1 prisoner is at risk in this design.

context
Black and White Hats

Hey Victor, thanks for the comment. If you take a closer look at the solution, you'll see that it works for any number of white and black hats. Try it for the extreme case 0 black hats followed and 100 white hats.

They key thing to remember is the third part in the solution: spoiler Based on the previous responses, keeping track of whether they should expect an odd or even number of white hats in front of them, every prisoner can determine whether they are wearing a black or white hat.

context
Cut the pizza into 11 equal slices with a wrist watch

I'm pretty sure #ProblemsMakeYouHungry is going to take off as a hashtag.

context
No if() Only abs()

Agreed, unless both a and b are zero...

context
Prisoners and hats

Agreed, I just posted a clearer one here if you're interested: http://www.mindcipher.com/puzzles/151

context
Prisoners and hats

Here's a clearer version: http://www.mindcipher.com/puzzles/151

context
Black and White Hats

Good question. No, the other prisoners don't need to know whether each prisoner answered correctly.

context

Submitted Puzzles 38

3 3 Guilty Innocence
I am a drug dealer. I have been questioned by the police with all of my drugs surrounding me, but I was not arrested. Why?
Easy
2.6
5 1 Matchsticks
This is a classic Martin Gardner puzzle. See the picture - the four matchsticks represent a martini glass and the match head represents an olive. Move just two matches so that the glass is reformed bu ...
Doable
3.7
14 100 Light Bulbs
There are 100 light switches, all of them are off. First, you walk by them, turning all of them on. Next, you walk by them turning every other one off. Then, you walk by them changing every third on ...
Hard
7.7
5 2 Troll Toll
You are on your way to visit your Grandma, who lives at the end of the valley. It’s her birthday, and you want to give her the cakes you’ve made. Between your house and her house, you have to cross ...
Easy
2.9
3 Divide 1 to 20
What is the smallest whole number that can be divided by any number from 1 to 20 (inclusive) and not leave a remainder? For example, 60 is the smallest number that can be divided evenly by all the n ...
Doable
5.2
4 2 Don't Eat Me!
Would you rather a crocodile attack you or an alligator?
Doable
4.7
41 29 All the King's Wine
So there's this king. Someone breaks into his wine cellar where he stores 1000 bottles of wine. This person proceeds to poison one of the 1000 bottles, but gets away too quickly for the king's guard ...
Hard
7.6
4 2 The Middle of Nowhere
What is in the middle of "nowhere"? The answer is indisputable, and not based on some philosophy.
Easy
2.3
11 7 Coin Flip
On Monday, you flip a coin all day. You start flipping it until you see the pattern Head, Tail, Head. You record the number of flips required to reach this pattern, and start flipping again (and co ...
Doable
6.0
2 Farmer's Market
You’re a farmer. You’re going to a market to buy some animals. On the market there are 3 types of animals for sale. You can buy: Horses for £10 each, goats for £1 each and ducks, you get 8 of these ...
Doable
5.2
7 12 Black and White Hats
There are 100 prisoners in jail. Their guards decide to play a game with them. Here's what happens: 1) The prisoners are lined up in a single file, front to back, such that the prisoner at the back of ...
Hard
8.7
3 The fake coin
You have 9 coins which all look identical but 1 of them weight less than the others. You have a two pan balance (see the picture) with which you can measure twice, and with this 2 measurements you ha ...
Doable
4.0
6 1 The bus stop
You’re driving your car to work in the pouring rain when you see three people on the side of the road at an uncovered bus stop. You recognize one as your best friend waiting to go to work, the second ...
Doable
4.7
2 3 The Bookworm
Looking onto a shelf you see three books each labeled Volume 1, Volume 2, and Volume 3 respectively. Each book is 2.5 inches thick; that is the pages are 2 inches, and each cover .25 inches. A bo ...
Doable
5.0
3 2 The Price Is Right
Many shops have prices set just under a round figure, e.g. $9.99 instead of $10.00 or $99.95 instead of $100.00 . It is assumed that this is done because the price seems lower to the consumer. But th ...
Hard
7.0
9 5 Fork in the road
You are walking down a road and arrive at a fork that splits the road into two separate paths. When you reach, you meet two identical twins, each standing at the edge of one of the two paths. You h ...
Doable
6.4
8 Simple 24
Why is that if p is a prime number bigger than 3, then p^2-1 is always divisible by 24 with no remainder?
Hard
7.3
1 2 The Way Engineers Think
A priest, a doctor, and an engineer were waiting one morning for a particularly slow group of golfers. Engineer: What’s with these guys? We must have been waiting for 15 minutes! Doctor: I don’t ...
Doable
6.0
6 8 Non-Adaptive 12 Identical Balls
Okay - so I posted this puzzle to reddit a few weeks ago and one guy had the following comment: Same problem, but your solution must be non-adaptive. IOW, specify the weighings that you will make up f ...
Hard
8.7
3 Power of 2 (Microsoft Interview)
Given any number n, using one line of C (using no external libraries or functions) code, determine if n is a power of 2. Return 1 if n is a power of 2 and 0 if not.
Doable
6.0
3 What number is next?
What number comes next in this sequence? 4, 20, 56, 120, 220, ?
Doable
5.0
3 2 Left Hands Only
Assume there are approximately 6,000,000,000 (6 billion) people on Earth. What would you estimate to be the result if you multiply together the number of fingers on every person’s left-hands? For t ...
Hard
7.0
2 2 Tick Tock
With a seven-minute hourglass and an eleven-minute hourglass, what is the quickest way to time the boiling of an egg for fifteen minutes?
Easy
2.8
2 1 What Am I?
Give me food, and I will live Give me water, and I will die What am I?
Doable
6.0
0 2 Don't be a Square
Shown is a large square made up of four shapes, and a separate square, labeled with an E. Using all five of the shapes (A through E) only once, can you form a second perfect square?
Doable
6.0
3 5 Don't Mate in One
This problem was first publicized by Karl Fabel, a German chess problemist. Find a move for white that will not result in an immediate checkmate of the black king.
Hard
7.0
2 1 Lockers
A high school has a strange principal. On the first day, he has his students perform an odd opening day ceremony: There are one thousand lockers and one thousand students in the school. The princip ...
Hard
8.0
4 Microsoft Interview Question - Count it Out
This problem is more targeted towards people with Computer Science or similar backgrounds, it is a REAL question from an interview with Microsoft. You have an array of 99 unique numbers from 0-100. ...
Doable
4.7
1 2 Running Race
Phil and Sal race each other for 100 yards. Sal wins by 10 yards. They decide to race again, but this time, to even things up, Sal begins 10 yards behind the start line. Assuming that both run with t ...
Doable
4.0
0 2 My eyes
My eyes fold like telescopes and view the world like periscopes Who am I? For a hint you should know I run really slow and walk as fast as i can. Do you know who I am?
Doable
6.0
6 6 The Neighbourhood
People say Einstein suggested that 98% of the world’s population couldn’t figure out the answer to this puzzle. It is not for the faint of heart: There are 5 houses each with a different color. Th ...
Hard
7.3
0 1 What is Sammy exactly?
Police! Police! She cried, Police! he died! Sammy was my friend. If this is the end and i wont see him again, let me give just a kiss. Sammy was my friend. Down the roar he shall slide turning ro ...
Doable
3.3
4 2 Boys and Girls
To help solve an acute national over-population problem, a government issues a radical decree that families must stop having children as soon as they have had one son. After a while, there are some ...
Doable
5.4
8 1 Three Idols
Here's a classic: Three gods A, B, and C are called, in some order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a comp ...
Hard
10.0
3 Gone Camping
Camp Crona’s cook, Allison, was just about to begin preparing the picnic lunch for all the campers. She already knew she needed to fill 55 bowls of the same size and capacity with the same amount of fo ...
Easy
2.9
2 3 Attic Light Switch
A downstairs panel contains three on-off switches. One of them controls the lamp in your attic. Using only ONE trip up to the attic, how do you determine which switch controls the lamp?
Doable
4.4
5 2 Salary
Three coworkers would like to know their average salary. how can they do it, without disclosing their own salaries.
Doable
5.0
4 6 Balloon in an Elevator
A person is holding on to a helium balloon in an elevator. The elevator cable snaps, and at the exact same moment, the person lets go of the helium balloon. In the perspective of the person in the el ...
Hard
8.7