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

# Tag Archives: inversion

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

Given an array a[] on which, the following two types of inversions are performed: Count of pairs of indices (i, j) such that A[i] >… Read More

Pre-requisite: Policy based data structure Given an array arr[], the task is to find the number of inversions for each element of the array. Inversion… Read More

Given an array arr[], the task is to finds the total significant inversion count for the array. Two elements arr[i] and arr[j] form a significant… Read More

Given a Binary tree and number of nodes in the tree, the task is to find the number of pairs violating the BST property. Binary… Read More

Given two integers A and B where A is not divisible by B, the task is to express A / B as a natural number… Read More

Given a binary matrix. The task is to flip the matrix horizontally(find the image of the matrix), then invert it. Note: To flip a matrix… Read More

Given an array of integers arr, the task is to count the number of inversions in the array. If A[i] > A[j] and i <… Read More

Given an array of n distinct integers and an integer k. Find out the number of sub-sequences of a such that , and . In… Read More

Given an unsorted array of distinct elements. Task is to count number of cross lines formed in an array elements after sorting the array elements.… Read More

Given an array and an integer k, count all inversions in all subarrays of size k. Example: Input : a[] = {7, 3, 2, 4,… Read More

We have an array A of n integers that we’re planning on sorting. Specifically, we want to know how close the array is to sorted.… Read More

Given a permuted array of length N of first N natural numbers, we need to tell the minimum number of swaps required in the sorted… Read More

Given an array of integer values which need to be sorted by only one operation – subarray rotation where subarray size should be 3. For… Read More