Skip to content

Tag Archives: array-rearrange

Given an array arr[] of size N of positive integers. The task is to rearrange the array after applying the conditions given below:  If arr[i]… Read More
You are given X[] of length 2*N, Where N will always be odd, the task is to construct an array Y[] of length N from… Read More
Given an arr[] containing distinct positive integers of length N(2 ≤ N), the task is to rearrange the array elements in such a way that… Read More
Given a permutation of first N positive integers, the task is to form the lexicographically smallest permutation such that the new permutation does not have… Read More
Given an array B1[] and a binary array B2[] each of size N, the task is to rearrange array B1[] in a way such that… Read More
Given an array arr[] of N integers. Arrange the array in a way such that the minimum distance among all pairs of same elements is… Read More
Given an array arr of length N, the task is to rearrange the elements of given array such that for each element, its bitwise XOR… Read More
Given an array arr[] of even length N, the task is to perform the following operations on the given array: Split the given array in… Read More
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array… Read More
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array… Read More
Python3 # Python3 program to implement # the above approach   # Function to return Mth element of # array after k right rotations def… Read More
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array… Read More
Given an arr[ ] of size N, containing positive, negative integers and one zero. The task is to rearrange the array in such a way… Read More
Given an array arr[] of size N. The task is to find the number of sequences in which any one of the following conditions is… Read More
Given an array of n elements. Our task is to write a program to rearrange the array such that elements at even positions are greater… Read More