## Permutations of n things taken all at a time with m things never come together

Given n and m, the task is to find the number of permutations of n distinct things taking them all at a time such that… Read More »

## Seating arrangement of N boys sitting around a round table such that two particular boys sit together

There are N boys which are to be seated around a round table. The task is to find the number of ways in which N… Read More »

## Count of distinct rectangles inscribed in an equilateral triangle

Given an equilateral triangle made of dots (.) joined together to form triangle and an integer n which represents the length of the sides of… Read More »

## Count arrays of length K whose product of elements is same as that of given array

Given an integer array arr[] of length N and an integer K, the task is to count the number of possible arrays of length K… Read More »

## Implementing next_permutation() in Java with Examples

Given an array or string, the task is to find the next lexicographically greater permutation of it in Java. Examples: Input: string = “gfg” Output:… Read More »

## All reverse permutations of an array using STL in C++

Given an array, the task is to print or display all the reverse permutations of this array using STL in C++. Reverse permutation means, for… Read More »

## Number of ways to go from one point to another in a grid

Given the NxN grid of horizontal and vertical roads. The task is to find out the number of ways that the person can go from… Read More »

## All permutations of an array using STL in C++

Given an array, the task is to print or display all the permutations of this array using STL in C++. Examples: Input: a[] = {1,… Read More »

## Maths behind number of paths in matrix problem

The problem is to count all the possible paths from top left to bottom right of an m*n matrix with the constraints that from each… Read More »

## Print all permutations of a string in Java

Given a string str, the task is to print all the permutations of str. A permutation is an arrangement of all or part of a… Read More »

## Puzzle | 1000 light bulbs switched on/off by 1000 persons passing by

There are 1000 light bulbs and 1000 persons. All light bulbs are initially off. Person 1 goes flipping light bulb 1, 2, 3, 4, …… Read More »

## Permutations of n things taken r at a time with k things together

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… Read More »

## Check if any permutation of N equals any power of K

Given a positive integer N and K where and . The task is to check whether any permutation of digits of N equals any power… Read More »

## Permutation of an array that has smaller values from another array

Given two arrays A and B of equal size. The task is to print any permutation of array A such that the number of indices… Read More »

## Number of permutations of a string in which all the occurrences of a given character occurs together

Given a string ‘s’ and a character ‘c’, the task is to find the number of permutations of the string in which all the occurrences… Read More »