Puzzle – Five Friends

Five friends are standing in a line. Each of them is wearing either a red shirt or a green shirt. What is the order of the friends from left to right, and what color shirt is each person wearing? Here are the clues:

• The person on the left is wearing a green shirt.
• The person on the right is wearing a red shirt.
• The person in the middle is wearing a green shirt.
• The second person from the left is wearing a red shirt.
• The second person from the right is wearing a green shirt.

Solution:

• We know that there are only two colors of shirts: red and green. We also know the color of the shirt worn by the person on the left (green) and the person on the right (red). Let’s call the five friends A, B, C, D, and E, in order from left to right.
• We know that the person in the middle is wearing a green shirt, so B must be wearing a green shirt. We also know that the second person from the left is wearing a red shirt, so A must be wearing a red shirt. The second person from the right is wearing a green shirt, so D must be wearing a green shirt.

That leaves us with two possible solutions: either C is wearing a red shirt and E is wearing a green shirt, or C is wearing a green shirt and E is wearing a red shirt. However, we know that the person on the left is wearing a green shirt, so the only solution that works is:

A (red), B (green), C (red), D (green), E (red)

Therefore, the order of the friends from left to right, and the color of the shirt worn by each person, is:

Puzzle: Five Friends

A (red), B (green), C (red), D (green), and E (red).

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Previous
Next