## Lexicographically smallest permutation with distinct elements using minimum replacements

Given an array of n positive integers such that each element of integer is from 1 to n. Find the lexicographically permutation that can be… Read More »

- Java Program to print distinct permutations of a string
- Generating Lyndon words of length n
- Number of unique pairs in an array
- Sum of all Submatrices of a Given Matrix
- Count of Numbers in Range where first digit is equal to last digit of the number
- Count of sub-sets of size n with total element sum divisible by 3
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Number of triangles that can be formed with given N points
- Count unordered pairs (i,j) such that product of a[i] and a[j] is power of two
- Total number of subsets in which the product of the elements is even
- Count of Numbers in a Range where digit d occurs exactly K times
- K length words that can be formed from given characters without repetition
- Count of Numbers in Range where the number does not contain more than K non zero digits
- Count the number of special permutations
- Permutations of string such that no two vowels are adjacent
- Number of permutations of a string in which all the occurrences of a given character occurs together
- Ways to paint N paintings such that adjacent paintings don't have same colors
- Number of trailing zeroes in base 16 representation of N!
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1
- Count pairs in an array such that LCM(arr[i], arr[j]) > min(arr[i],arr[j])
- Number of moves required to guess a permutation.
- Minimum and Maximum number of pairs in m teams of n people
- Python program to get all subsets of given size of a set
- Minimum numbers needed to express every integer below N as a sum
- Count ordered pairs of positive numbers such that their sum is S and XOR is K
- Ways to form n/2 pairs such that difference of pairs is minimum
- Count sub-sets that satisfy the given condition
- Maximum points of intersection n lines
- Ways to divide a binary array into sub-arrays such that each sub-array contains exactly one 1
- Number of ways to arrange a word such that all vowels occur together

Given an array of n positive integers such that each element of integer is from 1 to n. Find the lexicographically permutation that can be… Read More »

Given a n × m binary matrix, count the number of sets where a set can be formed one or more same values in a… Read More »

The Alexander Bogomolyn’s algorithm is used to permute first N natural numbers. Given the value of N we have to output all the permutations of… Read More »

A stable tower of height n is a tower consisting of exactly n tiles of unit height stacked vertically in such a way, that no… Read More »

Consider a coding competition on geeksforgeeks practice. Now their are n distinct participants taking part in the competition. A single participant can make pair with… Read More »

Given a list of arrays, find all combinations where each combination contains one element from each given array. Examples: Input : [ [1, 2], [3,… Read More »

Given an input string of numbers, find all combinations of numbers that can be formed using digits in the same order. Examples: Input : 123… Read More »

Count the number of Binary Tree possible for a given Preorder Sequence length n. Examples: Input : n = 1 Output : 1 Input :… Read More »

Given two positive numbers ‘n’ and ‘m’ (n <= m) which represent total number of items of first and second type of sets respectively. Find… Read More »

Given a 3 X n board, find the number of ways to color it using at most 4 colors such that no two adjacent boxes… Read More »

Given a set of characters generate all possible passwords from them. This means we should generate all possible permutations of words using the given characters,… Read More »

Given a natural number n, find the number of ways in which n can be expressed as a sum of natural numbers when order is… Read More »

A cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number. The most widely known is the… Read More »

Given a number N, our task is to generate all the possible cyclic permutations of the number. A cyclic permutation shifts all the elements of… Read More »

Generate all possible subset of size r of given array with distinct elements. Examples: Input : arr[] = {1, 2, 3, 4} r = 2… Read More »