Suppose we need to arrange n people such that m of them should never come together? How many possible ways are there ?

0 votes

This question can be solved using simple combinatorics logic -

You can treat that group of m people as one person, then total number of people will be (n - m + 1) which can be arranged in (n - m + 1)! ways but remember if n, m are big this value can be too high which can't be stored in simple integer data type, I would suggest you to use string multiplication or biginteger class in Java to calculate that number.

You can read about them at these links -

...