Given three numbers N, A, and X, the task is to construct the lexicographically smallest binary array of size N, containing A 0s and having… Read More

# Tag Archives: inversion

Given an array, arr[] of size N denoting a permutation of numbers from 1 to N, the task is to count the number of inversions… Read More

Given an array arr[], the task is to append the given array exactly K – 1 times to its end and print the total number… Read More

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and… 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 < j… 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. Note:… 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, 1},… Read More