# In how many different ways can I arrange $n$ girls and $m$ boys with no at least $k$ boys or $k$ girls sit next to each other?

For example, we have $$n = 5$$ boys and $$m = 6$$ girls, we don't want $$k \le min(n, m)$$ | $$k = 3$$ boys or girls to sit next to each other.

A valid arrangement: $$BBGGBGGBGG$$

An invalid arrangement: $$BBBGGBGGBGG$$ - There are $$3$$ boys sit next to each other.

And we ignore the permutation between any group of boys and girls so $$BBGGBGGBGG$$ is considered only $$1$$ way

• elcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. – José Carlos Santos Nov 18 '18 at 9:58
• Note that sometimes it is impossible, for example if you have 10 boys and 2 girls and k=3, because in any arrangement you use there will be 3 or more boys sitting next to each other. I think for the general case you must have $k>\frac{|m-n|}{2}-2$ But I might be wrong in this one – Fareed AF Nov 18 '18 at 10:20
• I'm sorry, It should be like this $k \le min(n, m)$. – Nhân Nguyễn Nov 18 '18 at 10:22
• @FareedAF If that scenario happens, the answer can only be 0 because there are no way we can arrange, right? – Nhân Nguyễn Nov 18 '18 at 10:32
• Yes thats what I meant by impossible, 0 ways – Fareed AF Nov 18 '18 at 10:33