Given two integers N and X which denotes the size of an array arr[] and the initial value of all the array elements respectively, the… Read More

# Tag Archives: array-rearrange

Given two binary matrices mat[][] and target[][] of dimensions N * M, the task is to find the minimum cost to convert the matrix mat[][]… Read More

Given an array, initially consisting of 0 as the only element present and Q operations of the following two types: Add(X): Insert X into the… Read More

Given two sorted arrays A[] and B[] consisting of N distinct integers, the task is to rearrange the elements of array B[] such that, for… Read More

Given an array arr[] consisting of N integers, the task is to make all array elements equal by selecting any pair of integers from the… Read More

Check if array can be sorted by swapping pairs having GCD equal to the smallest element in the array

Given an array arr[] of size N, the task is to check if an array can be sorted by swapping only the elements whose GCD… Read More

Given two integers N and K, the task is to maximize the sum of the Kth column of N * N row-wise sorted matrix consisting… Read More

Given an array arr[] consisting of N integers, the task is to determine the total number of array elements that can become the maximum value… Read More

Given an array A[] consisting of N distinct integers and another array B[] consisting of M integers, the task is to find the minimum number… Read More

Given an array arr[], the task is to convert it into a non-decreasing array by adding primes to array elements such that the sum of… Read More

Given an array arr[] consisting of N integers, the task is to find the maximum sum of an array formed by decreasing array elements by… Read More

Given an array arr[] consisting of N positive integers, the task is to find the minimum steps required to make the given array of integers… Read More

Given an array arr[] consisting of N integers, the task is to find the cost to remove all array elements after performing the following operations… Read More