The number of ways, 5 boys and 4 girls can sit in a row so that either all the boys sit together or no two boys sit together, is
If all the boys sit together, then there will be 4 girls and 1 group of boys.
Number of ways in which the boys can be arranged = 5!
Number of ways in which 4 girls and 1 group of boys can be arranged = 5!
Total number of ways in which we can arrange 4 girls and 5 boys such that all the boys sit together =
Now, we have to arrange the boys and girls such that no two boys sit together.
So, we will first fix the positions of girls in 1 way where girls are sitting at the alternate positions (not at the first or the last position) out of the total 9 positions.
Girls will sit at 2nd, 4th, 6th and 8th positions.
Number of ways in which the girls are arranged = 4!
Now, the boys will sit in the remaining places.
Number of ways in which the boys are arranged = 5!
Total number of ways in which we can arrange the boys and girls such that no two boys sit together =
Total number of ways in which we can arrange 5 boys and 4 girls such that either all the boys sit together or no boys sit together at all =
\therefore\ The required answer is 17280.
Tagged Arrangements with restrictions. Machine-assigned, so read it as a strong shortlist rather than a verdict.