# Tag Archives: permutation

Given a string str consisting of N letters, the task is to find the total number of strings that can be generated by replacing each… Read More
Given integers N and K, the task is to find the number of possible arrangements of N people around a circular table such that K… Read More
Given two integers S and X representing the sum and bitwise XOR respectively of two integers, the task is to find the count of all… Read More
Given an integer N and an array arr[] of M pairs of type (Ai, Bi), the task is to generate the lexicographically smallest possible permutation… Read More
Given an integer array having N elements ranging from 1 to N and each element appearing exactly once. The task is to find the number… Read More
Given an integer N and the task is to generate a permutation of the numbers in range [1, N] such that:  The GCD of all… Read More
Given two integers N, Y, generate a permutation of length N such that sum of all prefix minimum of that permutation is Y. Example:  Input:… Read More
Given a binary string str of size N containing 0 and 1 only, the task is to count all possible distinct binary strings when a… Read More
Given an integer N, the task is to generate a permutation from 1 to N such that the bitwise XOR of differences between adjacent elements… Read More
Given two integers, N and K, the task is to find the number of permutations of numbers from 0 to N – 1, such that… Read More
Given an integer N, the task is to construct a permutation from 1 to N where no adjacent elements have difference as 1. If there… Read More
Given two integers N and K, the task is to check if it is possible to form a permutation of N integers such that it… Read More
Given an array arr[] of N integers, the task is to find a value K such that the operation arr[ i ] = arr[ i… Read More
Given an array arr[] of size N which is a permutation from 1 to N, the task is to find the lexicographically smallest permutation that… Read More
Given an integer N, the task is to print a permutation of numbers from 0 to N-1, such that: There is no duplicate element in… Read More