Everyone Overthinks This Tricky Interview Puzzle…
Can You Solve It?
Everyone Overthinks This Tricky Interview Puzzle…
Can You Solve It?
Today, we’re going to take a look at a very interesting puzzle known to be asked in several interviews, many years ago. Here it is…
There are 100 doors in a long hallway, and every single one starts closed.
Now a person walks through the hallway 100 times. On the first walk, they touch every door. On the second walk, they touch every 2nd door. On the third walk, every 3rd door. On the fourth walk, every 4th door. This keeps going until the 100th walk, where they only touch the 100th door.
Every time a door is touched, it switches. Closed becomes open. Open becomes closed.
Now, to solve this puzzle, we must answer the question… after all 100 walks are done, which doors are still open?

Could you figure out which doors are open after the 100 walks are done? Image by author.
Now, before you scroll down and reveal the solution, I recommend you grab a pen and a sheet of paper and try to solve this problem yourself!
Solution
Do you have your answers yet? Well, here’s the correct solution…
The smartest move to solve this problem is to start thinking about how many times each door gets touched.
Door 12, for example, gets touched on walk 1, 2, 3, 4, 6, and 12. That’s because those are the numbers that divide 12. So really, each door is just being touched once for every factor it has.
Most numbers have factors in pairs. For 12, it’s 1 and 12, 2 and 6, 3 and 4. That means door 12 gets switched an even number of times. Since it started closed, it ends closed again.
But square numbers are the ones that don’t.
Door 25 gets touched on walk 1, 5, and 25. The 5 doesn’t have a different partner because 5 × 5 is 25. So instead of having an even number of factors, it has an odd number.
And that changes everything. A door that gets switched an odd number of times ends open.
So the only doors left open are the perfect squares:
1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
Therefore, the only doors that are still open after 100 walks are Doors 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
Could you solve this tricky puzzle? Let me know in the comments section :)
메타데이터
- post_id
- ccb443d82dd9
- slug
- everyone-overthinks-this-tricky-interview-puzzle-ccb443d82dd9
- url
- https://medium.com/puzzle-sphere/everyone-overthinks-this-tricky-interview-puzzle-ccb443d82dd9
- canonical_url
- https://medium.com/puzzle-sphere/everyone-overthinks-this-tricky-interview-puzzle-ccb443d82dd9
- author_url
- https://medium.com/@RitvikNayak
- status
- ok
- fetched_at
- 2026-07-09 16:18:44