Skip to content

Category Archives: Sorting

Given an array arr[] of size N, the task is to find the largest element in the longest subarray consisting only of even numbers or… Read More
Given a string str of length N and an integer K, the task is to check if a string has two non-overlapping substrings of length… Read More
Given two arrays A[], consisting of N integers, and B[], consisting of taste values of M chocolates and an integer X, the task is to… Read More
Given an array arr[] of size N representing integers required to be read as a data stream, the task is to calculate and print the… Read More
Given a 2D array arr[][] with each row of the form { X, Y }, where Y and X represents the minimum cost required to… Read More
Given an array A[ ] consisting of N positive integers, such that each array element Ai denotes the count of elements of ith type, the… Read More
Given a vector of pairs arr[] and Q queries in the form of pairs in an array Queries[], the task for each query is to… Read More
Given an array, arr[] of size N whose elements from left to right, must be read as an incoming stream of integers, the task is… Read More
Given an array arr[] consisting of N distinct integers, the task is to rearrange the array such that no element is same as its index… Read More
Given a 2D array ranges[][] of size N * 2, with each row representing a range of the form [L, R], the task is to… Read More
Given an array arr[] of size N, two positive integers M and K, the task is to partition the array into M equal length subsets… Read More
Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More
Given an array arr[] consisting of N positive integers and an integer K, the task is to minimize the difference between the maximum and minimum… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to split the array into K subsets (N % K… Read More
Given an array arr[] of size N, the task is to find the frequency of each distinct element present in the given array. Examples: Input:… Read More