# Category Archives: Arrays

## Length of longest subsequence having absolute difference of all pairs divisible by K

Given an array, arr[] of size N and an integer K, the task is to find the length of the longest subsequence from the given… Read More »

## Number of pairs whose sum is a power of 2 | Set 2

Given an array arr[] consisting of N positive integers, the task is to count the maximum number of pairs (arr[i], arr[j]) such that arr[i] +… Read More »

## Number of pairs whose product is a power of 2

Given an array arr[] consisting of N integers, the task is to count the total number of pairs of array elements from the given array… Read More »

## Minimize elements to be added to a given array such that it contains another given array as its subsequence | Set 2

Given an array A[] consisting of N distinct integers and another array B[] consisting of M integers, the task is to find the minimum number… Read More »

## Maximize sum of squares of array elements possible by replacing pairs with their Bitwise AND and Bitwise OR

Given an array arr[] consisting of N integers, the task is to find the maximum sum of the squares of array elements possible from the… Read More »

## Count pairs from an array having product of their sum and difference equal to 1

Given an array arr[] of size N, the task is to count possible pairs of array elements (arr[i], arr[j]) such that (arr[i] + arr[j]) *… Read More »

## Smallest missing non-negative integer upto every array index

Given an array arr[] of size N, the task is for every array indices is to find the smallest missing non-negative integer upto that index… Read More »

## Count even length subarrays having bitwise XOR equal to 0

Given an array arr[] of size N, the task is to count all possible even length subarrays having bitwise XOR of subarray elements equal to… Read More »

## Count pairs from an array having product of their sum and difference equal to 0

Given an array arr[] of size N, the task is to count possible pairs of array elements (arr[i], arr[j]) such that (arr[i] + arr[j]) *… Read More »

## Split array into two subsequences having minimum count of pairs with sum equal to X

Given an array arr[] consisting of N integers and an integer X, the task is to split the array into two subsequences such that the… Read More »

## Minimum number of operations to convert a given sequence into a Geometric Progression | Set 2

Given an array arr[] consisting of N integers, the following three operations can be performed on any element one at a time: Add one to… Read More »

## Generate all distinct subsequences of array using backtracking

Given an array arr[] consisting of N positive integers, the task is to generate all distinct subsequences of the array. Examples: Input: arr[] = {1,… Read More »

## Maximize sum of array elements removed by performing the given operations

Given two arrays arr[] and min[] consisting of N integers and an integer K. For each index i, arr[i] can be reduced to at most… Read More »

## Find a number K such that exactly K array elements are greater than or equal to K

Given an array a[] of size N, which contains only non-negative elements, the task is to find any integer K for which there are exactly… Read More »

## Split array into minimum number of subsets having maximum pair sum at most K

Given an array, arr[] of size N and an integer K, the task is to partition the array into the minimum number of subsets such… Read More »