Print this page Share

Puzzles for Programmers and Pros

ISBN: 978-0-470-12168-9
240 pages
May 2007
Puzzles for Programmers and Pros (0470121688) cover image


  • Aimed at both working programmers who are applying for a job where puzzles are an integral part of the interview, as well as techies who just love a good puzzle, this book offers a cache of exciting puzzles
  • Features a new series of puzzles, never before published, called elimination puzzles that have a pedagogical aim of helping the reader solve an entire class of Sudoku-like puzzles
  • Provides the tools to solve the puzzles by hand and computer
  • The first part of each chapter presents a puzzle; the second part shows readers how to solve several classes of puzzles algorithmically; the third part asks the reader to solve a mystery involving codes, puzzles, and geography
  • Comes with a unique bonus: if readers actually solve the mystery, they have a chance to win a prize, which will be promoted on wrox.com!
See More

Table of Contents

Acknowledgments v

Introduction xi

Part I: Mind Games 1

We can't all be winners. 3

Sweet Tooth 4

Byzantine Bettors 6

A Touch of Luck 8

Information Gain 10

Reach for the Sky! 12

Pork Politics 14

Social Games 15

Escape Management 19

Flu Math 21

Imagination rules... 23

Whipping Ice 24

Optimal Jargon 29

Using Your Marbles 31

Flipping Colors 33

Scheduling Tradition 34

Fractal Biology 35

As Easy as Pie 37

Getting on the right side of luck 41

Lucky Roulette 42

Legal Logic 44

The Box Chip Game 47

Feedback Dividends 49

What are you thinking? 53

Number Clues 54

Mind Games 56

Refuse and Reveal 59

A Biting Maze 61

Mad Mix 63

Doing more with less 65

Dig That! 66

Preferential Romance 68

No Change for the Holidays 71

Quiet in the Depths 73

Solutions 74

Solution to Sweet Tooth 74

Solution to Byzantine Bettors 74

Solution to A Touch of Luck 76

Solution to Information Gain 78

Solution to Reach for the Sky! 78

Solution to Pork Politics 79

Solution to Social Games 80

Solution to Escape Management 81

Solution to Flu Math 83

Solution to Whipping Ice 84

Solution to Optimal Jargon 86

Solution to Using Your Marbles 88

Solution to Flipping Colors 89

Solution to Scheduling Tradition 90

Solution to Fractal Biology 91

Solution to As Easy as Pie 94

Solution to Lucky Roulette 96

Solution to Legal Logic 96

Solution to The Box Chip Game 97

Solution to Feedback Dividends 102

Solution to Number Clues 103

Solution to Mind Games 104

Solution to Refuse and Reveal 108

Solution to A Biting Maze 110

Solution to Mad Mix 112

Solution to Dig That! 113

Solution to Preferential Romance 116

Solution to No Change for the Holidays 117

Solution to Quiet in the Depths 118

Part II: The Secret of the Puzzle 121

Order the Ages 126

Urban Planning 128

Solution to Urban Planning 129

Finding a Schedule That Works 131

Solution to Finding a Schedule That Works 132

Picturing the Treasure 133

Solution to Picturing the Treasure 135

Sudoku 138

Solution to Sudoku 146

Number Encoding 147

Solution to Number Encoding 149

Selective Greed 150

Solution to Selective Greed 155

Sweet Packs 156

Solution to Sweet Packs 158

Revisiting a Traveling Salesman 159

Solution to Revisiting a Traveling Salesman 163

Overloaded Scheduling and Freezing Crystals 164

Solution to Overloaded Scheduling and Freezing Crystals 170

Wordsnakes 171

Solution to Wordsnakes 173

Maximal Friends 174

Solution to Maximal Friends 176

Winning at the Slots 177

Solution to Winning at the Slots 179

Understanding Dice 181

Solution to Understanding Dice 183

Bait and Switch 184

Solution to Bait and Switch 186

Part III: Faithful Foes 189

Index 221

See More

Author Information

Dr. Dennis Shasha is a professor of Mathematical Sciences in the Department of Computer Science at NYU. Along with research and teaching in biological computing, pattern recognition, database tuning , cryptographic file systems, and the like, Dennis is well-known for his mathematical puzzle column for Dr. Dobbs whose readers are very sharp and his Puzzling Adventures Column for the Scientific American. His puzzle writing has given birth to fictional books about a mathematical detective named Dr. Ecco. Dr. Shasha has also co-authored numerous highly technical books. Dennis speaks often at conferences and is a tireless self-promoter in the world of “mensa-like” puzzles.
See More


Download TitleSizeDownload
The cryptograms from Part III of the book 56.50 KB Click to Download
See More


Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
Part 1 14 Error in Text
Currently reads:
in Solution to Warm-Up, "fraction 25/55 of the money"
Should be:
"fraction 25/51 of the money"
Currently reads:
In Warm-up "25/55"
Should be:
In Warm-up "25/51"
Currently reads:
In Q1 Which coalitions might form?
Should read:
Which other coalitions might form?
Currently reads:In Q2 for B to receive as much money as possible?
changed to be:
for B to guarantee to receive
3 June 2015
part1 50 Error in Text
Currently reads:
Should read
3 June 2015
Part 1 64 Error in Text
Question 4
Currently reads:
In addition, you have the big bucket again with capacity over 100 liters
Should Read:
In addition, you have the big bucket again with capacity just over 5 liters
6 June 2015
solutions 75 Error in Text
Currently reads:
On the second line after the displayed section."A and C" Should be:
"A and D"
3 June 2015
Soultions 77 Error in Text
Currently reads:
The second line of the answer, for question 6, "her 180"
Should be:
"her 190"
3 June 2015
solutions 110-111 Error in Text
The correct order for the maze puzzle should be:
f43, if,

f39, you

f34, would

f33, see

f41, all

f46, of

f29, nature

f54, gathered

f24, up

f52, at

f17, one

f13, point

f47, in

f55, all

f35, her

f30, loveliness

f14, and

f19, her

f37, skill

f0, and

f2, her

f15, deadliness

f16, and

f40, her

f10, sex

f51, where

f21, would

f31, you

f32, find

f12, a

f27, more

f7, exquisite

f23, symbol

f22, than

f53, the

f28, mosquito

f5, if you have found the whole route to get here, you have solved the maze. congratulations.
3 June 2015
Part 1 116 Error in Text
Solution to Dig That!
Readers found that seven probes always suffices. Start by probing the central street at the six places marked in Figure 26. If all six probes detect a tunnel, you are done; otherwise, the rows where no tunnel was detected indicate that the tunnel was dug either one street east or one street west (but not both, since there is not sufficient length for that). To resolve this, assume the missing sections are east and probe for one of them; if it is not found, all the missing sections must be west.
6 June 2015
Part 2 126 Error in Text
Currently reads:
"proceeding in clockwise order"
Should be:
"proceeding in counterclockwise order"
3 June 2015
sweet pack 158 Error in Text
Currently reads:
In solution 1 of the Sweet Packs problem, 1, 6, 29, and 37
should be:
1 5 24 37
3 June 2015
Part 2 170 Error in Text
Solution to Overloaded Scheduling and Freezing Crystals A reader found a total of 171 by suggesting a schedule of T14 T19 T16 T10 T1 T2 T12 T18 T4 T5 T7 T3
T14 T19 T16 T10 T8 T1 T12=T18 T6 T5 T7 T3
See More
Back to Top