mscripts interview question

Puzzle 3 bulb 3 switch