Skip to content

Tag Archives: subsequence

Given a string S of length n and a positive integer k. The task is to find number of Palindromic Subsequences of length k where… Read More
Given n elements and a ratio r, find the number of G.P. subsequences with length 3. A subsequence is considered GP with length 3 with… Read More
Given a binary array, the task is find the size of the largest sub_sequence which having equal number of zeros and one. Examples : Input… Read More
Given a String S, consider a new string formed by repeating the S exactly K times. We need find the number of subsequences as “ab”… Read More
Given a number of at most 100 digits. We have to check if it is possible, after removing certain digits, to obtain a number of… Read More
Given a string s, print all possible subsequences of the given string in an iterative manner. We have already discussed Recursive method to print all… Read More
Given a binary string, find the longest subsequence of the form (0)*(1)*(0)* in it. Basically we need to divide the string into 3 non overlapping… Read More
Given a binary array, find length of the longest subsequence such that there is no 0 after a 1. Examples: Input : 1 1 0… Read More
Given an array of size N, find count of subsequences which when multiplied result in a number which is a power of 2. Examples: Input… Read More
Given an array A[] (1<=A<=10) of size N (1<=N<=10), find number of subsequences of length 3 whose sum is divisible by M (1<=M<=10). Examples: Input… Read More
Given a array of n positive and negative integers, find the subsequence with the maximum even sum and display that even sum. Examples: Input: arr[]… Read More
Given a string S, find the length of longest balanced subsequence in it. A balanced string is defined as:- A Null string is a balanced… Read More
Given a string S and an integer K. The task is to find lexicographically largest subsequence of S, say T, such that every character in… Read More
Given a non negative array, find the number of subsequences having product smaller than K. Examples: Input : [1, 2, 3, 4] k = 10… Read More
Given a string, we have to find out all subsequences of it. A String is a subsequence of a given String, that is generated by… Read More