Given four integers X, Y, M and N. The task is to find the number of ways to form a word by choosing X number of vowels and Y number of consonants from total numbers of M vowels and N consonants.
Input : X = 2, Y = 2, M = 3, N = 3
Output : 216
The total number of ways of choosing 2 vowels from a total number of 3 vowels is i.e 3
The total number of ways of choosing 2 consonants from a total number of 3 consonants is i.e 3.
The total number of ways of selecting 2 consonants from 3 and 2 vowels from 3 is * = 9
The total number of ways of arranging 4 letters among themselves = 4! = 24
Hence, the required number of ways = 24 * 9 = 216
Input : X = 1, Y = 2, M = 2, N = 3
Output : 36
- The total number of ways of choosing X vowels from a total number of M vowels is
- The total number of ways of choosing Y consonants from a total number of N consonants is
- The total number of ways of selecting Y consonants from N and X vowels from M is *
- The total number of ways of arranging (X+Y) letters among themselves = (X+Y)!
- Hence, the required number of ways = (X+Y)! * *
Below is the implementation of the above approach:
- Number of words that can be made using exactly P consonants and Q vowels from the given string
- Check whether all the substrings have number of vowels atleast as that of consonants
- Encrypt string with product of number of vowels and consonants in substring of size k
- Modify string by removing vowels in between two consonants
- Replace all consonants with nearest vowels in a string
- Count strings with consonants and vowels at alternate position
- Modify the string by swapping continuous vowels or consonants
- Arrange consonants and vowels nodes in a linked list
- Replace consonants with next immediate consonants alphabetically in a String
- Arrangement of words without changing the relative position of vowel and consonants
- Find substrings that contain all vowels
- Queries to find the count of vowels in the substrings of the given string
- Count the number of vowels occurring in all the substrings of given string
- Number of ways to arrange a word such that all vowels occur together
- Number of ways to arrange a word such that no vowels occur together
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.