Skip to Content
Puzzles for Programmers and Pros
book

Puzzles for Programmers and Pros

by Dennis E. Shasha
May 2007
Intermediate to advanced
240 pages
5h 20m
English
Wrox
Content preview from Puzzles for Programmers and Pros

6.1. Order the Ages

You might encounter elimination puzzles like this one in Mensa-style books. As mental calisthenics, they have a lot to recommend them.

Andrew, Carol, Jessica, Luke, and Tommy are sitting around a circular table. Carol is 12 years older than her neighbor to the left. Tommy is five years older than his neighbor to the right. Jessica is 14 years older than her neighbor to the left. Luke is five years younger than his neighbor to the left. By age, from youngest to oldest, they are ordered as follows: Luke, Tommy, Andrew, Jessica, and Carol. Luke is 16 and Carol is 40. The total of the ages is 135. In which order are the people sitting (starting with Tommy and then proceeding in clockwise order) and what are their ages? First try to do this on your own; when you've solved it or are ready for help, read on.

Start with the most specific facts: Luke is 16 and Carol is 40, totaling 56. This implies that the ages of Tommy, Andrew, and Jessica add up to 79 (135 - 56 = 79). Further, we know that Tommy and Luke are neighbors because Luke's left neighbor is 21, so if that's not Tommy, then both Tommy and Luke's left neighbors are 21 or less (because Tommy is second youngest after Luke). This leaves 79 - 42 = 37 left for the last person. But Carol is 12 years older than her neighbor to the left, so someone must be 28 years old. Hence, in clockwise order we must have Tommy, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mobile Game Development With Corona SDK

Mobile Game Development With Corona SDK

J.A. White
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9780470121689Purchase book