← All problemsSign in

Black and White

Alan is a simple man, he likes to only wear either black or white shirts. He has a collection of $N$ shirts which has $s_1$ black shirts and $s_2$ white shirts. He calls an arrangement of shirts in the set beautiful if nowhere in the set there are more than $k_1$ successive black shirts or more than $k_2$ successive white shirts one after another. Find the number of beautiful arrangements. Note

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