# Tag Archives: subsequence

Given an array arr[] of size N. The task is to find the number of subsequences whose sum is even and the number of subsequences… Read More
Given an array, find the number of subsequences whose sum is even and the number of subsequences whose sum is odd.  Example:   Input: arr[] =… Read More
Given a list or array of integer, the task is to print all such subsequences of this list such in which the elements are arranged… Read More
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
Given an array a of size N. The task is to find a subsequence X of length K such that gcd(X, X) + (X, X)… Read More
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
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
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
Given an integer N, the task is to check if the product of every consecutive set of digits is distinct or not. Examples:  Input: N… Read More
Given a string array arr[], the task is to find the longest sub-sequence of the array with at least one character appearing in all the… Read More
Given a sorted array of N integers. The task is to find the longest subsequence such that every element in the subsequence is reachable by… Read More
Given two strings str1 and str2 of lengths M and N respectively. The task is to find all the distinct strings of length M +… Read More
Given two integers N and M, the task is to find the count of possible sequences a1, a2, … of length N such that the… Read More
Given an array arr[] of N elements, the task is to find the length of the smallest sub-array which has the sequence {0, 1, 2,… Read More
Given a sequence of positive integers of length N. The only operation allowed is to insert a single integer of any value at any position… Read More