# Category Archives: Arrays

## Maximize count of array elements required to obtain given sum

Given an integer V and an array arr[] consisting of N integers, the task is to find the maximum number of array elements that can… Read More »

## Queries to search for an element in an array and modify the array based on given conditions

Given an array arr[] conssiting of N integers and an integer X, the task is to print the array after performing X queries denoted by… Read More »

## Count pairs in an array whose product is composite number

Given an array, arr[] of size N, the task is to count all the pairs of the given array whose product is a composite number.… Read More »

## Implement Undo and Redo features of a Text Editor

Given an array of strings Q[], consisting of queries of the following types: “WRITE X”: Write a character X into the document. “UNDO”: Erases the… Read More »

## Count possible permutations of given array satisfying the given conditions

Given an array, arr[] consisting of N distinct elements, the task is to count possible permutations of the given array that can be generated which… Read More »

## Closest value to K from an unsorted array

Given an array arr[] consisting of N integers and an integer K, the task is to find the array element closest to K. If multiple… Read More »

## Lexicographically smallest permutation of size A having B integers exceeding all preceeding integers

Given two positive integers, A and B, the task is to generate the lexicographically smallest permutation of all integers up to A in which exactly… Read More »

## Count smaller primes on the right of each array element

Given an array A[] of size N, the task for each array element is to count the array elements on their right that are smaller… Read More »

## Nth term of given recurrence relation having each term equal to the product of previous K terms

Given two positive integers N and K and an array F[] consisting of K positive integers. The Nth term of the recurrence relation is given… Read More »

## Subarray of length K whose concatenation forms a palindrome

Given an array arr[], consisting of N integers in the range [0, 9], the task is to find a subarray of length K from which… Read More »

## Maximize number of days for which P chocolates can be distributed consecutively to N people

Given an integer, P denoting the number of chocolates and an array a[] where ai denotes the type of ith chocolate. There are N people… Read More »

## Check if sum of array can be reduced to zero by repetitively reducing array element by their index value

Given an array arr[] consisting of N integers, the task is to determine if the sum of array elements can be reduced to 0 by… Read More »

## Maximize length of increasing subsequence possible by replacing array element by nearest primes

Given an array arr[], the task is to maximize the length of increasing subsequence by replacing elements to greater or smaller prime number to the… Read More »

## Kth smallest element from an array of intervals

Given an array of intervals arr[] of size N, the task is to find the Kth smallest element among all the elements within the intervals… Read More »

## Count pairs with bitwise XOR exceeding bitwise AND from a given array

Given an array, arr[] of size N, the task is to count the number of pairs from the given array such that the bitwise AND(&)… Read More »