Given a string, find the count of distinct subsequences of it. Examples: Input : str = "gfg" Output : 7 The seven distinct subsequences are… Read More

# Tag Archives: subsequence

Given two strings, find the number of times the second string occurs in the first string, whether continuous or discontinuous. Examples: Input: string a =… Read More

The Longest Bitonic Subsequence problem is to find the longest subsequence of a given sequence such that it is first increasing and then decreasing. A… Read More

The Maximum Sum Increasing Subsequence problem is to find the maximum sum subsequence of a given sequence such that all elements of the subsequence are… Read More

Java code: The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements… Read More

Given two strings X and Y, print the shortest string that has both X and Y as subsequences. If multiple shortest supersequence exists, print any… Read More

Given two sequences, print all longest subsequence present in both of them. Examples: Input: string X = "AGTGATG" string Y = "GTTAG" Output: GTAG GTTG… Read More

Given a string, find if there is any subsequence of length 2 or more that repeats itself such that the two subsequences doesn’t have the… Read More

Prerequisites : LCS, LIS Given two arrays, find length of the longest common increasing subsequence [LCIS] and print one of such sequences (multiple sequences may… Read More

Given a string, find out if the string is K-Palindrome or not. A k-palindrome string transforms into a palindrome on removing at most k characters… Read More

Given a binary string, count minimum number of subsequences to be removed to make it an empty string. Examples : Input: str[] = "10001" Output:… Read More

Given two strings, find the length of longest subsequence present in both of them. Examples: LCS for input Sequences “ABCDGH” and “AEDFHR” is “ADH” of… Read More

Subarray/Substring A subbarray is a contiguous part of array. An array that is inside another array. For example, consider the array [1, 2, 3, 4],… Read More

The longest Zig-Zag subsequence problem is to find length of the longest subsequence of given sequence such that all elements of this are alternating. If… Read More

Given a string, find length of the longest repeating subseequence such that the two subsequence don’t have same string character at same position, i.e., any… Read More