Given an array arr[] of integers, the task is to find the maximum sum of any sub-sequence in the array such that any two adjacent… Read More

# Tag Archives: subsequence

Given an array of size N and an integer K. The array consists of only digits {0, 1, 2, 3, …k-1}. The task is to… Read More

Given a string str, the task is to find the number of odd length palindromic sub-sequences around of str with str[i] as center i.e. every… Read More

Given a permutation from 1 to N of size N. Find the length of the longest subsequence having the property that the first and last… Read More

Given an array arr[] of N elements. The task is to find the number of sub-sequences which have at least two consecutive elements such that… Read More

Given a string str consisting of digits, the task is to find the number of possible 4 digit sub-sequences which are of the form (x,… Read More

Given an array arr[] of N integers, the task is to find the longest sub-sequence in the given array such that for all pairs from… Read More

Given a sorted array of positive integers where arr[i] > 2*arr[i-1], check whether a sub sequence exists whose sum is equal to k.Examples: Input :… Read More

Given an array arr[] of N integers, you can select some indexes such that every selected index has exactly one other selected index adjacent to… Read More

Given an array sequence [A1, A2 …An], the task is to find the maximum possible sum of increasing subsequence S of length k such that… Read More

Given an array of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be… Read More

Given an array A[] containing N elements and an integer K. The task is to calculate the product of all elements of subsequences of size… Read More

Given an array arr[] of N integers. The task is to count the number of sub-sequences whose sum is 0. Examples: Input: arr[] = {-1, 2,… Read More

Given a merged sequence which consists of two sequences which got merged, one of them was strictly increasing and the other was strictly decreasing. Elements… Read More

Given an array arr[] of N elements and a positive integer K. The task is to find the longest sub-sequence in the array having LCM… Read More