I have an affinity for these. And since it’s starting to be recruiting season for me, I think back to the interviews I had when I was a wee little undergrad. Trilogy Software in Austin asked me this one:
You have 100 people lined up in a row next to 100 closed lockers. The row of people will walk by all of the lockers. When they do, they behave like this:
Person 1 will toggle every locker (“toggle” means that if it is closed, she opens it, but if it is open, she closes it).
Person two will toggle every other locker.
Person three will toggle every third locker.
Person four will toggle every fourth locker.
Etc.
Question: when all 100 people have finished walking by all 100 lockers, how many lockers are open? Which ones are they?
joel