Given n, r and K. The task is to find the number of permutations of different things taken at a time such that specific things always occur together.
Input : n = 8, r = 5, k = 2 Output : 960 Input : n = 6, r = 2, k = 2 Output : 2
- A bundle of specific things can be put in r places in (r – k + 1) ways .
- k specific things in the bundle can be arranged themselves into k! ways.
- Now (n – k) things will be arranged in (r – k) places in ways.
Thus, using the fundamental principle of counting, the required number of permutations will be:
Below is the implementation of the above approach:
- Permutations of n things taken all at a time with m things never come together
- Minimum time to reach a point with +t and -t moves at time t
- All permutations of an array using STL in C++
- Number of palindromic permutations | Set 1
- Problem on permutations and combinations | Set 2
- All reverse permutations of an array using STL in C++
- Count permutations that are first decreasing then increasing.
- Find the number of good permutations
- Count the number of special permutations
- Permutations of string such that no two vowels are adjacent
- Check if two Linked Lists are permutations of each other
- Print all permutations of a string in Java
- Generate all cyclic permutations of a number
- Permutations to arrange N persons around a circular table
- Print all distinct permutations of a given string with duplicates
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.
Improved By : Mithun Kumar