# Tag Archives: permutation

## Count numbers up to N which contains at least one repeated digit

Given an integer N, the task is to count the numbers less than or equal to N such that each number contains at least one… Read More »

## Maximum inversions possible after exactly K removals from given array

Given an array arr[] consisting of N integers, and an integer K, the task is to find the maximum number of inversions of the given… Read More »

## Count lexicographically increasing K-length strings possible from first N alphabets

Given two positive integers N and K, the task is to find the number of K length strings that can be generated from the first… Read More »

## Count alphanumeric palindromes of length N

Given a positive integer N, the task is to find the number of alphanumeric palindromic strings of length N. Since the count of such strings… Read More »

## Difference between lexicographical ranks of two given permutations

Given two arrays P[] and Q[] which permutations of first N natural numbers. If P[] and Q[] are the ath and bth lexicographically smallest permutations… Read More »

## Minimum removal of characters required such that permutation of given string is a palindrome

Given string str consisting of lowercase letters, the task is to find the minimum number of characters to be deleted from the given string such… Read More »

## Generate original permutation from given array of inversions

Given an array arr[] of size N, where arr[i] denotes the number of elements on the left that are greater than the ith element in… Read More »

## Count sequences of positive integers having product X

Given an array arr[] of size N, the task is to find the total number of sequences of positive integers possible (greater than 1) whose… Read More »

## Count ways to generate N-length array with 0s, 1s, and 2s such that sum of all adjacent pairwise products is K

Given two integers N and K, the task is to find the number of N-length arrays that can be generated by using the values 0,… Read More »

## Check if permutation of first N natural numbers exists having Bitwise AND of adjacent elements non-zero

Given an integer N, the task is to check if there exists any permutation of the first N natural numbers [1, N] such that Bitwise… Read More »

## Rearrange array to make Bitwise XOR of similar indexed elements of two arrays is same

Given two arrays A[] and B[] consisting of N integers (N is odd), the task is to rearrange array B[] such that for each 1… Read More »

## Count ways to arrange N distinct objects if all clockwise arrangements are considered the same

Given N distinct objects, the task is to find the number of distinct arrangements of N objects if all clockwise arrangements are considered the same.… Read More »

## Number of permutation with K inversions | Set 2

Given two integers N and K, the task is to count the number of permutations of the first N natural numbers having exactly K inversions.… Read More »

## Print the last character of lexicographically smallest non-palindromic permutation of a string

Given string str, the task is to print the last character of the lexicographically smallest non-palindromic permutation of the given string. If no such permutation… Read More »

## Count possible binary strings of length N without P consecutive 0s and Q consecutive 1s

Given three integers N, P, and Q, the task is to count all possible distinct binary strings of length N such that each binary string… Read More »