# Category Archives: Arrays

## Count of distinct XORs formed by rearranging two Binary strings

Given two binary strings A and B of equal length N, the task is to find the number of distinct XORs possible by arbitrarily reordering… Read More »

## Minimum value of maximum absolute difference of all adjacent pairs in an Array

Given an array arr, containing non-negative integers and (-1)s, of size N, the task is to replace those (-1)s with a common non-negative integer such… Read More »

## Find the numbers present at Kth level of a Fibonacci Binary Tree

Given a number K, the task is to print the fibonacci numbers present at Kth level of a Fibonacci Binary Tree. Examples: Input: K =… Read More »

## Count pairs in Array whose product is a Kth power of any positive integer

Given an array arr[] of length N and an integer K, the task is to count pairs in the array whose product is Kth power… Read More »

## XOR of all Prime numbers in an Array at positions divisible by K

Given an array arr of integers of size N and an integer K, the task is to find the XOR of all the numbers which… Read More »

## Product of all Subarrays of an Array

Given an array of integers arr of size N, the task is to print products of all subarrays of the array. Examples: Input: arr[] =… Read More »

## Find XOR of all elements in an Array

Given an array arr[] containing integers of size N, the task is to find the XOR of this array. Examples: Input: arr[] = {2, 4,… Read More »

## Longest subsequence such that absolute difference between every pair is atmost 1

Given an integer array arr[] of size N, the task is to find the longest subsequence S such that for every a[i], a[j] ∈ S… Read More »

## How to flatten a Vector of Vectors or 2D Vector in C++

Given a Vector of Vectors (2D vector), the task is to flatten this 2d vector. Examples: Input: vector = [[1, 2, 3, 4], [5, 6],… Read More »

## Make array elements equal with minimum cost

Given an array of integers arr[], the task is to find the minimum number of steps to make array elements equal by following two operations… Read More »

## Minimum colors required such that edges forming cycle do not have same color

Given a directed graph with V vertices and E edges without self-loops and multiple edges, the task is to find the minimum number of colors… Read More »

## Reduce the array such that each element appears at most K times

Given a sorted array arr of size N, the task is to reduce the array such that each element can appear at most K times.… Read More »

## Maximum distance between two 1s in a Binary Array in a given range

Given a binary array of size N and a range in [l, r], the task is to find the maximum distance between two 1s in… Read More »

## Length of longest subsequence of Fibonacci Numbers in an Array

Given an array arr containing non-negative integers, the task is to print the length of the longest subsequence of Fibonacci numbers in this array. Examples:… Read More »

## Find the maximum value of Y for a given X from given set of lines

Given a set of lines represented by a 2-dimensional array arr consisting of slope(m) and intercept(c) respectively and Q queries such that each query contains… Read More »