# Tag Archives: subsequence

Given an array arr[], the task is to find the longest subsequence with a given OR value M. If there is no such sub-sequence then… Read More
Given an array arr[] and an integer M, the task is to find the longest subsequence with a given AND value M. If there is… Read More
Given an array arr[] and an integer M, the task is to find the length of the longest subsequence whose sum is divisible by M.… Read More
Given an array arr[], the task is to find the longest subsequence with a given AND value M. If there is no such sub-sequence then… Read More
Given an array arr[] of length N, the task is to find the length of the largest sub-sequence with non-negative sum.Examples:   Input: arr[] = {1,… Read More
Given an array arr[] of length N, the task is to find the length of the longest sub-sequence with the maximum possible GCD.Examples:   Input: arr[]… Read More
Given an array arr[] of length N, the task is to find the length of the longest sub-sequence with minimum possible LCM.Examples:   Input: arr[] =… Read More
Given an array arr[] of size N and an integer K, the task is to find the number of K length subsequences of this array… Read More
Given an array Arr and an integer K. The task is to find the number of subsequences of size K such that the LCM and… Read More
Given N strings containing of characters ‘a’ and ‘b’. These string can be concatenated in any order to make a single final string S. The… Read More
Given two arrays arr[] and cost[] where cost[i] is the cost associated with arr[i], the task is to find the minimum cost of choosing three… Read More
Given an array arr[] and an integer K, the task is to find the total number of subsequences from the array where each element is… Read More
Given an array arr[] of N integers and another integer K. The task is to find the maximum sum of a subsequence such that the… Read More
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