← All problemsSign in

Bulb Replacement

Bob wants to replace all the faulty bulbs in his house. He chose a very special way to do that. He puts all the bulbs($N$ in number) in a container. Now in each turn he randomly selects a bulb from the container. If the bulb is faulty, then he replaces the faulty bulb with a working bulb i.e. he throws the faulty bulb and puts a working bulb in the container. If the bulb he selects is working, he

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start