Avoid Contact
A hostel has $N$ rooms in a straight line. It has to accommodate $X$ people. Unfortunately, out of these $X$ people, $Y$ of them are infected with chickenpox. Due to safety norms, the following precaution must be taken: - No person should occupy a room directly adjacent to a room occupied by a chickenpox-infected person. In particular, two chickenpox-infected people **cannot** occupy adjacent roo
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.
Sign in to chat with the tutor and save your progress.
Sign in to start