## K difference permutation

Given two integers n and k. Consider first permutation of natural n numbers, P = “1 2 3 … n”, print a permutation “Result” such… Read More »

## Qualcomm Interview Experience | Set 7 (Off-Campus)

It was a very good experience to face interview at Qualcomm (Hyderabad-2016) I have attended the interview for a position of Software Engineer and My… Read More »

## Number of permutation with K inversions

Given an array, an inversion is defined as a pair a[i], a[j] such that a[i] > a[j] and i < j. We are given two… Read More »

## Sum of all numbers that can be formed with permutations of n digits

Given n distinct digits (from 0 to 9), find sum of all n digit numbers that can be formed using these digits. It is assumed… Read More »

## Longest common subsequence with permutations allowed

Given two strings in lowercase, find the longest string whose permutations are subsequences of given two strings. The output longest string must be sorted. Examples:… Read More »

## Check if an array can be Arranged in Left or Right Positioned Array

Given an array arr[] of size n>4, the task is to check whether the given array can be arranged in the form of Left or… Read More »

## Count permutations that produce positive result

Given an array of digits of length n > 1, digits lies within range 0 to 9. We perform sequence of below three operations until… Read More »

## MakeMyTrip Interview Experience | Set 11 (Developer Position)

I recently go interviewed for MakeMyTrip Developer position. I had 5 rounds: Round 1: 1) Reverse a Linked List – You should be able to… Read More »

## Heap’s Algorithm for generating permutations

Heap’s algorithm is used to generate all permutations of n objects. The idea is to generate each permutation from the previous permutation by choosing a… Read More »

## BogoSort or Permutation Sort

BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort or monkey sort is a particularly ineffective algorithm based on generate and test… Read More »

## How to find Lexicographically previous permutation?

Given a word, find lexicographically smaller permutation of it. For example, lexicographically smaller permutation of “4321” is “4312” and next smaller permutation of “4312” is… Read More »

## All permutations of a string using iteration

A permutation, also called an “arrangement number” or “order”, is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… Read More »

## Permutations of a given string using STL

A permutation, also called an “arrangement number” or “order”, is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… Read More »

## Permutation and Combination in Python

Python provide direct methods to find permutations and combinations of a sequence. These methods are present in itertools package. Permutation First import itertools package to… Read More »

## Print all palindrome permutations of a string

Given a string, we need to print all possible palindromes that can be generated using letters of that string. Examples: Input: str = “aabcb” Output:… Read More »