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:
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.
- Permutations of n things taken all at a time with m things never come together
- Number of permutations of a string in which all the occurrences of a given character occurs together
- Total number of ways to place X and Y at n places such that no two X are together
- 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
- Problem on permutations and combinations | Set 2
- Number of permutations such that sum of elements at odd index and even index are equal
- Check if two Linked Lists are permutations of each other
- Print all permutations of a string in Java
- All permutations of an array using STL in C++
- All reverse permutations of an array using STL in C++
- Count of permutations such that sum of K numbers from given range is even
- Count of distinct permutations of length N having no similar adjacent characters
- Count of permutations of an Array having each element as a multiple or a factor of its index
- Count permutations of given array that generates the same Binary Search Tree (BST)
- Count unimodal and non-unimodal permutations of first N natural numbers
- Queries of nCr%p in O(1) time complexity
- Maximum time in HH:MM:SS format that can be represented by given six digits
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.
Improved By : Mithun Kumar