## Iterative approach to print all permutations of an Array

Given an array arr[] of size N, the task is to generate and print all permutations of the given array. Examples: Input: arr[] = {1,… Read More »

- Print all permutations of a string in Java
- Iterative approach to print all permutations of an Array
- Minimize the number of replacements to get a string with same number of 'a', 'b' and 'c' in it
- Minimum number of given operations required to convert a permutation into an identity permutation
- Find the good permutation of first N natural numbers
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1
- Find the count of sub-strings whose characters can be rearranged to form the given word
- Find the number of good permutations
- Generate original array from difference between every two consecutive elements
- 3-digit Osiris number
- Find a permutation of 2N numbers such that the result of given expression is exactly 2K
- Find a permutation such that number of indices for which gcd(p[i], i) > 1 is exactly K
- Find the permutation p from the array q such that q[i] = p[i+1] - p[i]

Given an array arr[] of size N, the task is to generate and print all permutations of the given array. Examples: Input: arr[] = {1,… Read More »

Given an array Q[] of length N, the task is to find the permutation P[] of integers from the range [1, N + 1] such… Read More »

Given a 3-digit number N, the task is to find if N is an Osiris number or not. Osiris numbers are the numbers that are… Read More »

Given N – 1 differences between two consecutive elements of an array containing N numbers which are in range of 1 to N. The task… Read More »

Given a permutation P (P1, P2, P3, … Pn) of first n natural numbers. Find the minimum number of operations to convert it into an… Read More »

Given a string str, the task is to find the count of all the sub-strings of length four whose characters can be rearranged to form… Read More »

Given an integer N, the task is to print a good permutation of first N natural numbers. Let’s denote the ith element of the permutation… Read More »

Given two integers N and K. The task is to find the number of good permutations of first N natural numbers. A permutation is called… Read More »

Given two integers N and K, the task is to find a permutation of integers from the range [1, N] such that the number of… Read More »

Given two integers N and K, the task is to find a permutation of first 2*N natural numbers such that the following equation is satisfied.… Read More »

Given an integer N. The task is to find the permutation of first N natural numbers such that the absolute difference between any two consecutive… Read More »

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 »

Given a string consisting of only three possible characters ‘a’, ‘b’ or ‘c’. The task is to replace characters of the given string with ‘a’,… Read More »

Given an integer N and there is a hidden permutation (of numbers from 1 to N, each occurring exactly once) that you need to guess.… Read More »

Given two integers N and K, the task is to generate a permutation of N numbers (Every number from 1 to N occurs exactly once)… Read More »