Given $X$ boys and $Y$ girls, what are the number of ways to arrange them in a row such that no more than $Z$ individuals of the same gender are adjacent?
Example:
- Given $1$ boy, $1$ girl and $Z=1$, there is $2$ (the arrangements $BG, GB$)
- Given $2$ boys, $1$ girl and $Z=1$, there is $1$ (the arrangement $BGB$)
I tried calculating total number of combinations first $\frac{\left(X+Y\right)!}{X!Y!}$ then deducting the number of ways for each $z'<Z$ but this is where I'm stuck - I am not sure how to calculate this at each step
HINT:
For $Z=1$ it is not too hard you are on a good track there.
For $Z>1$ try to remove the undesired ones from all possible arrangements (this trick usually a good approach with "at least" or "no more than" statements)