The Wayback Machine - https://web.archive.org/web/20240118171033/https://www.geeksforgeeks.org/puzzle-six-houses-p-q-r-s-t-and-u/
Open In App
Related Articles

Puzzle | Six Houses P, Q, R, S, T, and U

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

There are three houses on each side of the road. These six houses are labeled as P, Q, R, S, T, and U. The houses are of different colors, namely, Red, Blue, Green, Orange, Yellow, and White. The houses are of different heights.

  • T, the tallest house, is exactly opposite to the Red-colored house.
  • The shortest house is exactly opposite to the Green colored house.
  • U, the Orange colored house, is located between P and S.
  • R, the Yellow-colored house, is exactly opposite to P.
  • Q, the Green colored house, is exactly opposite to U.
  • P, the white-colored house, is taller than R, but shorter than S and Q.

What is the color of the tallest house and how many houses are taller than the house R?

Solution: 

  • From the given information the tallest house is T and it is opposite to the Red-colored house. and the Shortest house is exactly opposite to the Green colored house.
  • The color of the house U is Orange and it is situated between P and S. It implies that houses P, S, and U are on one side of the road and the other three houses, namely, Q, R, and T are on another side of the road. P, S, and U can be placed in two ways. One way is {P, U, S}, and another way is {S, U, P}. 
  • The color of the house R is Yellow and it is opposite to P. 
  • The color of the house Q is Green and it is opposite of U. The shortest house is exactly opposite to the Green colored house it means the shortest house is U. 
  • The remaining house T, the tallest house, is opposite to S. The color of the house which is exactly opposite to T is Red. It means the color of S is Red. P, the white-colored house, is taller than R, but shorter than S and Q. The heights of P, Q, R, and S can be arranged in two ways. One of the ways is {S, Q, P, R} and another way is {Q, S, P, R}. 
  • Therefore, {P, U, S} are one side on the road, and {R, Q, T} are on another side of the road. P is opposite to R, U is opposite to Q and S is opposite to T. These two cases are shown below:

Heights of houses also have two ways which are shown in the table below:

  CASE 1 CASE 2
Tallest T-Blue T-Blue
2nd Tallest Q-Green S-Red
3rd Tallest S-Red Q-Green
4th Tallest P-White P-White
5th Tallest R-Yellow R-Yellow
Smallest U-Orange U-Orange

From the above table,
The color of the tallest house is Blue and the tallest house is T. Therefore, there are four houses taller than R which are T, Q, S, and P.

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

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!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 18 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads