## Longest alternative parity subsequence

Given an array a of size N. The task is to print the length of the longest alternative odd/even or even/odd subsequence. Examples: Input: a[]… Read More »

## Print the lexicographically smallest array by swapping elements whose sum is odd

Given an array of N integers. The task is to find the lexicographically smallest array possible by applying the given operation any number of times.… Read More »

## Subsequence X of length K such that gcd(X[0], X[1]) + (X[2], X[3]) + … is maximized

Given an array a of size N. The task is to find a subsequence X of length K such that gcd(X[0], X[1]) + (X[2], X[3])… Read More »

## Find the maximum elements in the first and the second halves of the Array

Given an array arr[] of N integers. The task is to find the largest elements in the first half and the second half of the… Read More »

## Print all the peaks and troughs in an Array of Integers

Given an array of integers arr[], the task is to print a list of all the peaks and another list of all the troughs present… Read More »

## Sum of even elements of an Array using Recursion

Given an array arr[] of integers, the task is to find the sum of even elements from the array. Examples: Input: arr[] = {1, 2,… Read More »

## Maximum number of elements without overlapping in a Line

Given two arrays X and L of same size N. Xi represents the position in an infinite line. Li represents the range up to which… Read More »

## Maximum Bitwise AND value of subsequence of length K

Given an array a of size N and an integer K. The task is to find the maximum bitwise and value of elements of any… Read More »

## Product of Primes of all Subsets

Given an array a[] of size N. The value of a subset is the product of primes in that subset. A non-prime is considered to… Read More »

## Maximum value of division of two numbers in an Array

Given an array A of size N (> 2). The task is to find the maximum value of A[i] / A[j] Note: A[i] ≠ 0.… Read More »

## Recursive program to find all Indices of a Number

Given an array arr of size N and an integer X. The task is to find all the indices of the integer X in the… Read More »

## Quadruplet pair with XOR zero in the given Array

Given an array arr[] of N integers such that any two adjacent elements in the array differ at only one position in their binary representation.… Read More »

## Find the final sequence of the array after performing given operations

Given an array arr[] of size N, the task is to perform the following operation exactly N times, Create an empty list of integers b[]… Read More »

## Find all combinations of two equal sum subsequences

Given an array arr[] of integers, the task is to find all possible ways the array could be split into two subsequences such that the… Read More »

## Lexicographically largest permutation of the array such that a[i] = a[i-1] + gcd(a[i-1], a[i-2])

Given an array arr[] of size N (N > 2). The task is to find lexicographically largest permutation of the array such that arr[i] =… Read More »