Skip to content

Category Archives: Arrays

Given an array arr[] consisting of N distinct positive integers, the task is to find the minimum number of elements required to be swapped to… Read More
Given two arrays consisting of N distinct integers such that the array A[] and B[] are sorted in ascending and descending order respectively, the task… Read More
Given a sorted array arr[] consisting of N positive integers and an integer D, the task is to find the number of triplets (i, j,… Read More
Given an array(1-based indexing) arr[] consisting of N integers, the task is to find the leftmost index i such that the product of all the… Read More
Given a sorted array arr[] consisting of N integers and a positive integer K(such that N%K is 0), the task is to find the minimum… Read More
Given an array arr[] consisting of N integers and an array P[] consisting of M integers such that P[i] represents the score obtained by working… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to print all possible unique quadruplets (arr[i], arr[j], arr[k], arr[l])… Read More
Given an array arr[] consisting of N integers, the task is to find the sum of array elements that are equidistant from the two consecutive… Read More
Given an array arr[ ] consisting of N positive integers and a 2D array Q[][] consisting of queries of the form {i, val}, the task… Read More
Given an array arr[] of size N, the task is to find the index in the given array where the sum of the prime numbers… Read More
Given an array arr[] consisting of N distinct integers, the task is to convert the given array into a sequence of first N non-negative integers,… Read More
Given an array arr[] of size N consisting of 0, 1, 2, and 3 only, the task is to sort the given array in ascending… Read More
Given an array arr[] consisting of N ranges of the form {L, R}, the task is to find the maximize the number of ranges such… Read More
Given an array arr[] consisting of N positive integers, the task is to find an index from the array having count of prime numbers present… Read More