Tag Archives: array-rearrange

Given two arrays arr1[] and arr2[] of size N and M respectively, the task is to count the minimum number of swapps required between the… Read More
Given a array of strings S[] of size N (1 ≤ N ≤ 105), sort characters of each string in descending order and then print… Read More
Given an array arr[] consisting of 2* N elements in the form of { a1, a2, …, aN, b1, b2, …, bN }, the task… Read More
Given an array arr[] of size N, the task is to maximize the count of distinct array elements by repeatedly inserting absolute difference between all… Read More
Given an array arr[] of size N, the task is to empty given array by removing 2i – 1 array elements in each operation (i… Read More
Given a matrix B[][] of dimensions N * M, the task is to generate a matrix A[][] of same dimensions that can be formed such… Read More
Given an array arr[] consisting of N 0s and an array Q[][] with each row of the form (L, R)., the task for each query… Read More
Given an array arr[] of size N, the task is to find the smallest positive integer K such that incrementing or decrementing each array element… Read More
Given two arrays arr1[] and arr2[], both of size N and an integer X, the task is to check if the sum of same-indexed elements… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the maximum number of unique elements possible by… Read More
Given an array arr[] of size N and an integer D, the task is to make all array elements equal by incrementing or decrementing minimum… Read More
Given an array arr[], the task is to find the minimum number increments or decrements by 1 required to convert the array into a Fibonacci… Read More
Given a matrix, mat[][] of size N * M and two positive integers A and B, the task is to construct a matrix of size… Read More
Given an array, arr[] consisting of N positive integers, the task is to make all array elements equal to 1 by performing the following operations… Read More