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 »
Given an array of integers arr[0..n-1], count all pairs (arr[i], arr[j]) in the such that i*arr[i] > j*arr[j], 0 =< i < j < n.… Read More »
Given an array arr of non negative integers. We can perform a swap operation on any two adjacent elements in the array. Find the minimum… Read More »
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 »
A surpasser of an element of an array is a greater element to its right, therefore x[j] is a surpasser of x[i] if i <… Read More »
Given an array arr of size n. Three elements arr[i], arr[j] and arr[k] form an inversion of size 3 if a[i] > a[j] >a[k] and… Read More »
What is an inversion? Given an array arr, a pair arr[i] and arr[j] forms an inversion if arr[i] < arr[j] and i > j.