Comments on: N Doors Puzzle https://demo.ritambhara.in/n-doors-puzzle/ Coding / System Design Interviews Tue, 31 Jan 2017 15:48:37 +0000 hourly 1 https://wordpress.org/?v=6.7.2 By: Puzzle – Set 1 – Lets Code https://demo.ritambhara.in/n-doors-puzzle/#comment-1737 Tue, 31 Jan 2017 15:48:37 +0000 http://www.ritambhara.in/?p=399#comment-1737 […]  There are N doors in a row, numbered from 1 to N. Initially all are closed. Then you make N passes by N doors. In first pass you toggle (open the door if it is closed and close it if it is opened) all the doors starting from the first door. In the second pass you toggle every door whose number is a multiple of 2 (2, 4, 6, 8, 10…). In 3rd pass you toggle doors whose number is multiple of 3 (3, 6, 9, ..) and so on.. In the i‘th pass you toggle all the doors which are multiple of i. What will be the state of k‘th door after all the passes? […]

]]>