Given 2n girls and randomly divided into two subgroups each containing n girls. The task is to count the number of ways in which groups can be formed such that two beautiful girls are into different groups.
Let group be r1, r2, b1, b2 where b1 and b2 are beautiful girls
Groups are: ((r1, b1) (r2, b2)), ((r1, b2) (r2, b1)), ((r2, b2) (r1, b1)), ((r2, b1) (r1, b2))
Approach: There are two ways in which the two beautiful girls lie in different groups and corresponding to each way the remaining (2n – 2) girls can be divided into two groups is
Hence total number of ways are 2 *
Implementation Code :
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.
- Count number of ways to divide an array into two halves with same sum
- Number of ways of distributing N identical objects in R distinct groups with no groups empty
- Count subarrays such that remainder after dividing sum of elements by K gives count of elements
- Count of groups among N people having only one leader in each group
- Maximize difference between the Sum of the two halves of the Array after removal of N elements
- Puzzle | Dividing a Square into N smaller squares
- Minimize the sum of the squares of the sum of elements of each group the array is divided into
- Divide 1 to n into two groups with minimum sum difference
- Partition the array into two odd length groups with minimized absolute difference between their median
- Minimum integer such that it leaves a remainder 1 on dividing with any element from the range [2, N]
- Find the maximum elements in the first and the second halves of the Array
- Ways to arrange Balls such that adjacent balls are of different types
- Ways to color a skewed tree such that parent and child have different colors
- Number of ways of distributing N identical objects in R distinct groups
- Count the number of ways to divide N in k groups incrementally
- Minimize sum by dividing all elements of a subarray by K
- Largest number dividing maximum number of elements in the array
- Smallest number dividing minimum number of elements in the array | Set 2
- Smallest number dividing minimum number of elements in the Array
- Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.