There are n boys and n girls are to be seated around a round table, in a circle. The task is to find number of ways in which n boys and n girls can sit alternatively aound 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 DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Seating arrangement of N boys sitting around a round table such that two particular boys sit together
- Permutations to arrange N persons around a circular table
- Puzzle | Neighbors in a round table
- Shortest path from source to destination such that edge weights along path are alternatively increasing and decreasing
- Arrangement of words without changing the relative position of vowel and consonants
- Count of Binary strings of length N having atmost M consecutive 1s or 0s alternatively exactly K times
- Maximum height of triangular arrangement of array values
- Arrangement of the characters of a word such that all vowels are at odd places
- Multiplication table till N rows where every Kth row is table of K upto Kth term
- Calculate Stirling numbers which represents the number of ways to arrange r objects around n different circles
- Length of rope tied around three equal circles touching each other
- Round-off a number to a given number of significant digits
- Round the given number to nearest multiple of 10
- Round the given number to nearest multiple of 10 | Set-2
- Compute the parity of a number using XOR and table look-up
- Number of ways to arrange 2*N persons on the two sides of a table with X and Y persons on opposite sides
- Program to print multiplication table of a number
- Program for Binomial Coefficients table
- Find the number of cells in the table contains X
- Recursive Program to print multiplication table of a number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.