Seating arrangement of n boys and girls alternatively around a round table
There are n boys and n girls are to be seated around a round table, in a circle. The task is to find the number of ways in which n boys and n girls can sit alternatively around a round table. Given n<10
Input: n = 5 Output: 2880 Input: n = 1 Output: 1
- First find the total number of ways in which boys can be arrange on round table.
No. of ways to arrange boys on table = (n-1)!
- After making boys arrangement, now make arrangement for girls. As after seating boys there are n space available between them. So there are n position and n number of girls. So total number of arrangement in which girls sit between boys are n!.
- Therefore Total number of ways = (number of arrangement of boys) * (number of ways to sit girl among boys) = (n-1)! * (n!)
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.