# data[].attributes.body
Three Fastest Horses

We’d like to find the three fastest horses from a group of 25.

We have no stopwatch and our race track has only 5 lanes. No more than 5 horses can be raced at once.

How many races are necessary to evaluate the 3 fastest horses?

Here’s the solution.

# data[].attributes.body
From Algorithm Puzzles book

There are eight identical looking coins. one of these coins is counterfeit and is known to be a little lighter than the qenuine coins. What is the minimum number of weighings needed to identify the fake coin with a 2-pan balance scale without weights.

Hint: 3 is not the answer

# data[].attributes.body
There are te stacks of 10 identical looking coins. All of the coins in one of these stacks are counterfeit, and all the coins in hte otehr stacks are genuine. Every genuine coin weighs 10g, and every cointerfeit coin weighs 11g. You have an analytical scale that can determine the exact weight of any number of coins. What is the minimum number of weighings needed to identify the fake coins?

Hint: the answer is 1. How?

# data[].attributes.body
Attempt a solution before looking at an explanation

# data[].attributes.attachment_link.readable_text
A logic problem is a general term for a type of puzzle that is solved through deduction. Given a limited set of truths and a question, we step through the different scenarios until an answer is found. While these problems rarely involving coding, they require problem-solving and the ability to articulate plausible outcomes.

You may encounter logic problems during technical interviews for a programming position so it's worth developing a strategy on how to approach these questions. They're also a fun way to strengthen your algorithmic reasoning skills!

Our Question: Apples, Oranges, or Both?

We'll start with the following problem. You're faced with three jars labeled "Apples", "Oranges", and "Both". You cannot see the contents of these jars, but you're informed that each is mislabeled. The contents of the jar are not decribed by the label.

How many times would you need to draw from a jar in order to accurately label each jar?

Our Solution: Using the Information

Let's boil down our problem into factual statements we can use to draw conclusions.

1. The jars are mislabeled

2. There are three jars

3. One jar is a combination of the contents of the other two jars.

We can use these facts to deduce further information which will be instrumental in solving the problem.

First we can rephrase "the jars are mislabeled" as "the jar labeled 'Apples' does not contain Apples ". It's the same information but presented in a way that will be easier to work towards a solution.

We should also be drawn to item 3: there's more information available in the "Both" jar which makes it a more "fruitful" source of inquiry. In general, be aware of any exceptions or abnormalities in the phrasing of the question.

Our Solution: Filling in Scenarios

Now we'll begin walking through hypothetical situations. Being able to reason through the problem and articulate your thought process is essential to performing well in a technical interview.

Let's imagine we draw a fruit from the jar labeled "Apples". We know this jar doesn't only contain apples, but we're faced with two possibilities. We could draw an apple or we could draw an orange. If we drew an apple, we'd know this was the "Both" jar, but what if we drew an orange? Then this jar remains a mystery, either "Both" and we just happened to draw an orange, or it's purely "Oranges". We're still in the dark!

The thought process is the same for drawing from the "Oranges" jar, so now imagine drawing from the "Both" jar. Again, we may draw either type of fruit, but we've learned something more substantial. If we draw an orange, we know this is "Oranges". If we draw an apple, we know this is "Apples". There is no ambiguity because the jar is mislabeled as "Both".

Our Solution: Drawing Conclusions

We've identified one jar, do we need to make additional queries? We should return to our Use the Information step. Let's say we've identified "Oranges".

We have the old "Both" jar, now correctly labeled "Oranges", and two mislabeled jars: "Oranges" and "Apples". Can we draw further conclusions? We can!

"Apples" and "Oranges" are both mislabeled, but we have new information. We know where the true "Oranges" is. This doesn't help us with the mislabeled "Oranges", it could be either "Both" or "Apples".

It does help with "Apples". We know "Apples" is not "Oranges" because we've already identified "Oranges". We also know "Apples" isn't really "Apples" because it's mislabeled. That leaves only one option, this jar is "Both".

With two correctly labeled jars, the third is easily identified as "Apples"

To wrap it up: "Both" -> "Oranges", which leads us to "Apples" -> "Both" and "Oranges" -> "Apples"

Practice Makes Perfect!

We'll finish this article with a few practice problems for you to try on your own. Each problem has a link which will take you to an explanation of the solution.

"Knights and knaves" are a popular type of logic puzzle that involves an island inhabited by two types of people: knights and knaves.

Knights always tell the truth

Knaves always lie

On the island, you encounter three people, Ted, Ben and Lil.

Ted says, "at least one of the following is true, that Lil is a knave or that I am a knight."

Ben says, "Ted could claim that I am a knave."

Lil says, "neither Ted nor Ben are knights."

Who is a knight and who is a knave?
Here's the solution.
Three Fastest Horses

We'd like to find the three fastest horses from a group of 25.

We have no stopwatch and our race track has only 5 lanes. No more than 5 horses can be raced at once.

How many races are necessary to evaluate the 3 fastest horses?
Here's the solution.

# data[].attributes.attachment_link.description
A logic problem is a general term for a type of puzzle that is solved through deduction. Given a limited set of truths and a question, we step through the different scenarios until an answer is found. While these problems rarely involving coding, they require problem-solving and the ability to articulate plausible outcomes.

# data[].attributes.body
Knights and Knaves

“Knights and knaves” are a popular type of logic puzzle that involves an island inhabited by two types of people: knights and knaves.

Knights always tell the truth

Knaves always lie

On the island, you encounter three people, Ted, Ben and Lil.

Ted says, “at least one of the following is true, that Lil is a knave or that I am a knight.”

Ben says, “Ted could claim that I am a knave.”

Lil says, “neither Ted nor Ben are knights.”

Who is a knight and who is a knave?

Here’s the solution.

# data[].attributes.body
This puzzle uses a truth table which should help clarify.

Here is a link, but only look at the solution once you have given the puzzle some thought

https://brilliant.org/wiki/truth-tellers-and-liars/

# data[].attributes.attachment_link.readable_text
Though it is always possible to do casework to determine the truth of each claim, it is not always optimal or practical to go through all of the cases one by one; there might be far too many cases to do this work by hand, and some of the cases may even be quite similar. It is always a good idea to keep our ideas as concise as possible while still conveying the logic clearly. If possible, it is recommended to find shortcuts and figure out how to shorten our solution. Three of these common shortcuts are

1. proving the right answer via contradiction;

2. conditioning on specific constraints;

3. identifying and eliminating contradictory statements.

Technique 1: Proving the correctness of our answer by contradiction.

A solution describing tedious casework is often neither engaging nor concise. Even worse, it is sometimes unnecessary. For instance, in the example below, the impossible cases "Rachel's statement is true" and "Samantha's statement is true" are subsumed by an argument assuming "Teresa's statement is false:"

Technique 2: Conditioning on specific constraints.

Rather than simply enumerating cases via the possible truth values, it is sometimes useful to enumerate cases by conditioning on another constraint given in the problem. One way to spot problems like these is to find terms like "at least," "at most," or "exactly" used in all the statements.

Consider the following example:

After Mrs. Jacobs' five children received their test scores, she asked them what their test scores were.

Her first child said that at least one of them failed algebra.
Her second child said that at least two of them failed algebra.
Her third child said that at least three of them failed algebra.
Her fourth child said that at least four of them failed algebra.

If only one child is telling the truth, can you determine how many of Mrs. Jacobs' children failed algebra?

It's possible to condition on truth values and check the five cases "child is telling the truth," but this isn't quite optimal. We would then have to keep track of two variables while working through cases, i.e. who's telling the truth, and how many children failed algebra. It is easier to just go ahead and condition on the number of children who failed algebra:

Suppose exactly 4 children failed algebra, then all of them are telling the truth, which contradicts our assumption.
Suppose exactly 3 children failed algebra, then her first three children are telling the truth, which contradicts our assumption.
Suppose exactly 2 children failed algebra, then her first two children are telling the truth, which contradicts our assumption.
Suppose exactly 1 child failed algebra, then only her first child is telling the truth, which satisfies our assumption.
Suppose none of the children failed algebra, then none of her children is telling the truth, which contradicts our assumption.

Condition on specific constraints as you try solving these problems:

Technique 3: Identifying contradictory statements.

As mentioned above, it is not always ideal to solve problems like these by casework. But sometimes, it's easy to spot contradictory statements. For example:

Suppose there are 3 people A, B, and C, each of whom makes these claims:

Person A says, "B is telling the truth."
Person B says, "A is not guilty."
Person C says, "A is guilty."

Given that only one of them is telling the truth, can you determine who is guilty?

Trial and error would work here, but it isn't necessary. Notice that person B and person C gave contradicting viewpoints. So only one of them can be telling the truth, and the other must be lying. Because at least one of B and C is already telling the truth, A can't be telling the truth anymore. So A's statement is false, which means that B is not telling the truth. Thus C is telling the truth, or in other words, A is guilty.

The trick for these types of problems is to identify which pairs of statements can't be simultaneously true. Here's another problem where this technique applies:

# data[].attributes.attachment_link.title
Truth-Tellers and Liars | Brilliant Math & Science Wiki

# data[].attributes.attachment_link.description
Truth-tellers and liars problems (also called Knights and Knaves problems) are logic puzzles in which a set of statements is provided, but some of the statements are true and some of the statements are false. The goal of the puzzle is to determine which statements are true based on the information given.

# data[].attributes.headline
Truth tellers and liars - the path to doom

# data[].attributes.subject
Truth tellers and liars - the path to doom

# data[].attributes.body
https://suresolv.com/brain-teaser/liar-and-truth-teller-riddle-step-step-easy-solution

# data[].attributes.attachment_link.readable_text
Think methodically with common sense reasoning to solve the liar and truth-teller riddle

In liar and truth-teller riddle, to know the safe path, a traveler can ask only one question to any one of a habitual liar or a truth-teller. What to ask?

Story of the Riddle

Crossing over many a land, a traveler came upon a deep jungle where two paths forked and went into the depths of the jungle.

He had heard from a wise man someday earlier that such a forest lay ahead. The wise man had said, "One path will lead to the warmth of a friendly village, but the other will lead you into the den of hungry tigers and sure death."

Now only he remembered the rest of what the wise old man had said, "When you are at the fork trying to choose the safe path, two men will suddenly appear ready to help you. Beware, one of them will be a habitual liar-his answer to any question must always be a lie, but the other will just be the opposite-he always will tell you the truth."

The wise man finished, "Don't forget, you can ask only one question to any one the two to find the correct safe path. You won't have a second chance. They will understand your question, know which path is safe, know the nature of answering of each other but will answer only with YES or NO."

Recommended time for you to find the safe path: 15 minutes.

Comments

This is a classic logic puzzle from old times. Logicians who juggle with pure logic by choice would immediately tell you the right answer in no time. But we are not logicians. We are common folks who use common sense logic and deductive reasoning in our own way.

If you are not a logician have a go. The experience will be interesting.

You would get better results if you imagine yourself as the traveler.

Systematic Solution to the Liar and truth-teller Riddle - First stage: Key Pattern Discovery of the Nature of the Answer for Solving the Riddle

Without going deep into the riddle, you would do an initial experiment in mind. You will visualize what could be the answers from the two if you ask the single question,

Do you think the path to my left is the safe path that goes to the village of friendly people?

If indeed the left path IS the safe one,

The liar would answer: NO, and the Truth-teller: YES.

Without knowing which one of them is telling the truth, you won't be able to decide.

Thinking more you realize that you have,

Two unknown paths, and two men eager to help, but again you don't know their nature of habitual answering.

With such combinations of unknowns, you realize, it would be impossible to form the right question by thinking in the conventional way. You are clear now that,

You must form the question NOT in a simple way.

Without wasting time on what type of question you have to ask, your attention shifts to the ANSWER itself.

This is a very natural way to solve problems-to analyze and understand all characteristics of the end result first, comparing it with given information.

Note: To us this is End State Analysis Approach, an often used natural problem solving technique packed with power.

Thinking more in this direction, you ask yourself the most important QUESTION at this point,

What must be the NATURE OF THE ANSWER from the two for me to know the safe path?

You have already experienced that the answer to a simple question from one helper will be NO and the other, YES, just the opposite.

You make a firm conclusion,

If the answers from the two are OPPOSITE, you won't find the safe path.

There is no going away from this. The conclusion is actually a fact and an inviolable truth.

Ah ha, you couldn't imagine earlier it would come to this pass. Yes, for you to be for sure about the safe path,

Whatever be the question, answers from both the helpers must exactly be the SAME in every situation.

This is a revelation to you and in problem solving terminology this is, discovery of the key pattern. You have now a precise requirement of their answers in relation to each other (or precise requirement specification).

Naturally, the answer will be YES or NO. But if it is NO, both will answer NO. Same must also be true for YES for knowing safe path.

This is the first breakthrough. You feel half the battle you have won by knowing all about the answer that can be known.

Nature of answer fully identified, it is time to shift focus of attention to the NATURE OF THE QUESTION.

Systematic Solution to the Liar and truth-teller Riddle - Second stage: Process of Knowing Nature of the Question to ask

At this point you realize that you have to think in a NEW way to make the second breakthrough by understanding precisely the nature of the question which is the requirement specification for the question.

What can be a new form of a question! As you think more on this, the condition of "NEW form" strikes you and aided by the focus of the new form of question you reason,

Well, the usual simple form of the question has been a single question for any combination of situation. All combinations would have the same result ending in failure.

WHAT CAN BE CHANGED ABOUT THE QUESTION?
Property change analysis technique

This technique of exploring new ways to change a key property (in this case, the number of components in the question) of the key entity (in this case, the question itself) often produce great results for quick and innovative solution to the problem. This is called, Property change analysis.

Of course, you can very well change the number of component questions in the single combined question, especially as you remember from your experience,

Instead of a single question, two questions can easily be combined to form the single compound question.

When you were younger, your neighbor uncle once asked when you opened the door,

Is your father home? Is he well?

Your father was home and well. So you answered, "Yes".
One answer to two questions.
You further realize, if either your father were not home or not well or both, you might have simply answered, "No".

That must be the new way that would help you to know the safe path,

Instead of a one component single question, you would ask a single question with two components joined together by "and", the easiest way to join two questions.

And you know from elementary knowledge in language that such a compound question is easy to form-your neighbor uncle could have asked such a single question,

Is your father home and well?

You feel you have practically cracked the puzzle open and that too by using no difficult technique or concept.

You have followed just simple common sense problem solving techniques coupled with concepts drawn out of everyday real life experiences and elementary knowledge of language.

What have you achieved till now?

You know now the nature of the answer and the question both.

The only task of actually forming such a question with such an answer is left.

Systematic Solution to the Liar and truth-teller Riddle - Third stage: Forming the Question by using the Answer and Question Specifications

With clear idea of the nature of the answer and form of the question, a possible safe question to be asked would be,

Are you the truth-teller and do you think the path to my left is the safe path?

Possible situations are,

Situation 1: The helper asked is the truth-teller and the left path is the safe path: Final answer: YES.

Situation 2: The helper asked is the liar and the left path is the safe path, first answer result would be NO, so that answer to the combined question would truly be NO. Habitual liar, being what he is, cannot but reverse this NO to YES. Final answer: YES.

So if the answer to your question is YES, you know for sure that the left path is actually the safe path.

Alternatively, the other two possibilities are,

Situation 3: The helper asked is the truth-teller and the left path is NOT the safe path: Final answer: NO.

Situation 4: The helper asked is the liar and the left path is NOT the safe path, answer to both the parts are NO that would be reversed by the liar habitually to YES, opposite to the answer by the other helper. Final answer: YES. This violates the requirement specification of the answer.

Just on the brink of success you find that joining of two questions simply by "and" won't fully work.

There is a challenge yet to overcome at the third stage of using the specifications of the answer and question to form the right way to combine the two question components. You had assumed an easy way to combine the two questions without thinking much on question of how to combine.

But this is not all in vain- you would surely get important clues on how to combine by analyzing the results.

Systematic Solution to the Liar and truth-teller Riddle - Final stage: Identifying Crucial Requirement of Combining two Questions

Really, why and where did combining two questions by "and" fail?

As you concentrate on finding answer to this question by analyzing the result of your last attempt, you realize that,

Answers to the two component question 1 and question 2 are independent of each other, and,

There is no need to think what would be the answer of the truth-teller-because primarily your goal is to force the liar to reverse the answer of the truth-teller twice to match his final answer.

In the Situation 2, using "and" for joining, you could indeed force the liar to reverse the answer of the truth-teller twice.

But in the Situation 4, where true answer to both component questions were NO, the liar reversed each to YES and combined also to YES. HE was happy to think that he had indeed reversed the true combined answer and did justice to his habit!

To force the liar to reverse true answer twice by two questions then,

One question must be DEPENDENT on the other.

So, the successful method of combining the two questions must ensure that,

The liar would reverse true answer to the INDEPENDENT first question and thinking that has answered it in line with his habit would face the second DEPENDENT question and reverse answer to the first independent question once more by the second question thinking again that he had answered in line with his nature.

What is the other method of joining two questions that would achieve this result?

Again your common experience of using the language helps you for the final breakthrough.

There must be only one real question but asked twice in the commonly used form,

What would be your answer if I ask you whether the "QUESTION" is true?

The first of the two component questions the liar must answer following rules of the language is,

'whether the "QUESTION" is true.'

The liar reverses the correct answer to this first component question and forms the INTERMEDIATE RESULT in line with his nature of answering. With this result then he faces the second component question,

What will be your answer if "INTERMEDIATE RESULT" is true?

Now he would have no option other than to reverse the intermediate result which according to him is correct and form the final result. Final result becomes the REVERSE OF INTERMEDIATE RESULT.

As INTERMEDIATE RESULT has itself been reversed once from true result, the final result returns back to the value of the true result again by this double reversal.

Following is the schematic of this mechanism,

This is pure logic no doubt, but with reason, method and two trials, you have learned enough about how the single compound question must be formed and asked to any of the two helpers to find the safe path.

With confidence you finally form the single question that would lead you to know the safe path,

What will be your answer if I ask you whether the path to my left is the safe path?

You ask this question to any of the two helpers. If the answer is YES, you take the left path, and if it is NO, you take the right path.

There cannot be any other possibility-you have indeed forced the liar to reverse the true answer twice to match the final answer of the truth-teller in both the situations.

Knowing that answer to the question from both helpers will be same, you asked the question to any one of the two helpers.

Comment

You might have discovered the most crucial PRIMARY REQUIREMENT OF ACTION- the liar must be forced to reverse the true result twice- without going into the second trial at all.

This discovery is not difficult to make if you realize early that solving the riddle will vitally depend on finding the right answer to the question,

How to make answer of the liar same as the truth-teller in any situation!

The problem solving techniques, concepts and common knowledge used

End state analysis: Analyzing the desired result or last action first. Objective is to gain more knowledge about the last action for achieving the desired result.

Refining requirement specification in steps: Knowing precise requirements of the answer first and the question second simplified the steps to the solution greatly.

Question, analysis and answer or QAA technique: Simplifying the problem stage by stage by asking a series of relevant questions and analyzing each for getting its answer.

Property change analysis technique: Exploring how many ways the key property of a key entity can be changed and assessing promise of each change, often proves to be crucial in solving a complex problem. Great innovation can be created by this technique.

Elementary knowledge in language: Basic domain concepts: for combining two component questions to a single compound question but in different ways.

Well-formed trials or experiments: to learn more of the problem.

Step by step deductive reasoning: by using all of the above and discovering key patterns of information for solving the problem with complete confidence.

End note

We have used this puzzle for a different purpose earlier but here the focus is quite different.

Our focus all through the above solution process has been to think as the traveler in a simple way and find the safe path using systematic reasoning and problem solving techniques drawn out of common knowledge and experience step by step.

Puzzles you may enjoy

Riddles

Mathematical puzzles

Logic analysis puzzles
Liar and truth-teller riddle with step by step easy solution
River crossing puzzles
Farmer with fox, goose and bag of corn crossing the river puzzle 3 monkeys and 3 humans crossing river puzzle King queen minister washerman river crossing puzzle
Ball weighing puzzles

Matchstick puzzles

# data[].attributes.attachment_link.title
Liar and truth-teller riddle with step by step easy solution

# data[].attributes.attachment_link.description
In liar and truth-teller riddle, to know the safe path, a traveler can ask only one question to any one of a habitual liar or a truth-teller. What to ask? Crossing over many a land, a traveler came upon a deep jungle where two paths forked and went into the depths of the jungle.

# data[].attributes.body
https://www.mentalfloss.com/article/90600/can-you-solve-counterfeit-coin-puzzle

# data[].attributes.attachment_link.readable_text
Mathematicians have long plagued humankind with a style of puzzle in which you must weigh a series of items on a balance scale to find one oddball item that weighs more or less than the others. They're known collectively as balance puzzles, and they can be maddening...until someone comes along and trots out the answer.

Within the world of balance puzzles, the 12-coin problem is well-known (there's also a nine-coin variant, and a horrendous 39-coin variant). There is in fact a generalized solution for such puzzles [PDF], though it involves serious math knowledge.

In the video below, we are presented with a version of the 12-coin problem in which we must determine a single counterfeit coin in a dozen candidates. The problem is, we're only allowed the use of a marker (to make notes on the coins) and three uses of a balance scale. Here are the detailed conditions:

1) All 12 coins look identical.

2) Eleven of the coins weigh exactly the same. The twelfth is very slightly heavier or lighter.

3) The only available weighing method is the balance scale. It can only tell you if both sides are equal, or if one side is heavier than the other.

4) You may use the scale no more than three times.

5) You may write things on the coins with your marker, and this will not change their weight.

6) There's no bribing the guards or any other trick.

So how do we solve this specific case? Watch the video to find out.

For a bit more on this puzzle, check out this TED-Ed page.

Subscribe to our Newsletter!

# data[].attributes.attachment_link.title
Can You Solve the Counterfeit Coin Puzzle?

# data[].attributes.attachment_link.description
Mathematicians have long plagued humankind with a style of puzzle in which you must weigh a series of items on a balance scale to find one oddball item that weighs more or less than the others. They're known collectively as balance puzzles, and they can be maddening...until someone comes along and trots out the answer.

# data[].attributes.body
https://www.theguardian.com/science/2021/nov/29/can-you-solve-it-yule-devour-these-festive-treats

# data[].attributes.attachment_link.readable_text
Every year the remarkable maths website Mathigon runs a puzzle advent calendar, publishing a problem a day from December 1 to 24. I've had a peek at this year's puzzles and selected three of the ones I liked the most.
1. The seven digits

Note: 'products of' means 'multiplications of'.

2. A plurality of paths.

You could count them all one by one, but that's too laborious. There's a lovely method to be found instead.
3. Flipping frogs.

Thanks to Mathigon for today's puzzles. If you haven't visited the site before, it's a beautiful, free website that explores school maths via gorgeous and clever interactive animations.

I'll be back at 5pm UK with the solutions. Please NO SPOILERS!
Thanks to Philipp Legner of Mathigon. Flipping frogs was designed by James Tanton. The Mathigon puzzle advent calendar begins on December 1.

I set a puzzle here every two weeks on a Monday. I'm always on the look-out for great puzzles. If you would like to suggest one, email me. I also give school talks about maths and puzzles (restrictions allowing). If your school is interested please get in touch. I'm the author of several books of maths and puzzles, most recently The Language Lover's Puzzle Book, but all of which would make fantastic Christmas gifts!

# data[].attributes.attachment_link.title
Can you solve it? Yule devour these festive treats

# data[].attributes.attachment_link.description
Every year the remarkable maths website Mathigon runs a puzzle advent calendar, publishing a problem a day from December 1 to 24. I've had a peek at this year's puzzles and selected three of the ones I liked the most. 1. The seven digits 2. A plurality of paths.