Given two strings str of length N and word of length M, the task is to remove all the occurrences of the string word from… Read More

# Category Archives: Arrays

Array is a data structure that is used to store variables that are of similar data types at contiguous locations. The main advantage of the… Read More

Given an array A[] consisting of positive integers, the task is to calculate the minimum possible deviation of the given arrayA[] after performing the following… Read More

Given an array A[] consisting of N (1 ≤ N ≤ 105) positive integers, the task is to find the only array element with a… Read More

Given an array arr[] consisting of N 0s and a 2D array Q[][] consisting of queries of the following two types: 1 L R X:… Read More

Minimize swaps required to place largest and smallest array elements at first and last array indices

Given an array arr[] of size N, the task is to find the minimum count of adjacent swaps required to rearrange the array elements such… Read More

Given an array arr[] consisting of N positive integers, the task is to rotate the digits of array elements in an anti-clockwise direction such that… Read More

Given an array arr[] consisting of a permutation of numbers in the range [0, N – 1], the task is to find the length of… Read More

Given an array arr[] of size N, the task is to make all the array elements equal by performing following operations minimum number of times:… Read More

Given an array arr[], representing the ages of N persons in a hospital and there is only one doctor who can give an immune dose… Read More

Given an array arr[] of size N, the task is to find the number of prefix arrays whose maximum is less than the maximum element… Read More

Given an array arr[] consisting of N integers, representing the length of the sticks, the task is to find the maximum sum possible of all… Read More

Given an array arr[] consisting of first N natural numbers, construct a undirected graph using the array elements such that for any array element, connect… Read More

Given an array arr[] consisting of positive integers and an array Q[][] consisting of queries, the task for every ith query is to count array… Read More

Given an array arr[] of size N and a positive integer K, the task is to find the index of the smallest array element required… Read More