Longest common subsequence with permutations allowed
Given two strings in lowercase, find the longest string whose permutations are subsequences of given two strings. The output longest string must be sorted. Examples:… Read More » The post Longest...
View ArticlePrint all longest common sub-sequences in lexicographical order
You are given two strings.Now you have to print all longest common sub-sequences in lexicographical order? Examples: Input : str1 = "abcabcaa", str2 = "acbacba"… Read More » The post Print all longest...
View ArticleLCS (Longest Common Subsequence) of three strings
Given 3 strings of all having length < 100,the task is to find the longest common sub-sequence in all three given sequences. Examples: Input :… Read More » The post LCS (Longest Common Subsequence)...
View ArticleCount ways to increase LCS length of two strings by one
Given two strings of lower alphabet characters, we need to find the number of ways to insert a character in the first string such that… Read More » The post Count ways to increase LCS length of two...
View ArticleMinimum number of deletions and insertions to transform one string into another
Given two strings ‘str1’ and ‘str2’ of size m and n respectively. The task is to remove/delete and insert minimum number of characters from/in str1… Read More » The post Minimum number of deletions and...
View ArticleShortest Uncommon Subsequence
Given two strings S and T, find length of the shortest subsequence in S which is not a subsequence in T. If no such subsequence… Read More » The post Shortest Uncommon Subsequence appeared first on...
View ArticleShortest possible combination of two strings
Compute the shortest string for a combination of two given strings such that the new string consist of both the strings as its subsequences. Examples… Read More » The post Shortest possible combination...
View ArticleLongest Common Subsequence with at most k changes allowed
Given two sequence P and Q of numbers. The task is to find Longest Common Subsequence of two sequence if we are allowed to change… Read More » The post Longest Common Subsequence with at most k changes...
View ArticleLongest Repeated Subsequence
Given a string, print the longest repeating subseequence such that the two subsequence don’t have same string character at same position, i.e., any i’th character… Read More » The post Longest Repeated...
View ArticlePrint Longest Palindromic Subsequence
Given a sequence, print a longest palindromic subsequence of it. Examples : Input : BBABCBCAB Output : BABCBAB The above output is the longest palindromic… Read More » The post Print Longest...
View ArticleMinimum cost to make Longest Common Subsequence of length k
Given two string X, Y and an integer k. Now the task is to convert string X with minimum cost such that the Longest Common… Read More » The post Minimum cost to make Longest Common Subsequence of...
View ArticleNumber of ways to insert a character to increase the LCS by one
Given two strings A and B. The task is to count the number of ways to insert a character in string A to increase the… Read More » The post Number of ways to insert a character to increase the LCS by...
View ArticleLCS formed by consecutive segments of at least length K
Given two strings s1, s2 and K, find the length of the longest subsequence formed by consecutive segments of at least length K. Examples: Input… Read More » The post LCS formed by consecutive segments...
View ArticleMemoization (1D, 2D and 3D)
Most of the Dynamic Programming problems are solved in two ways: Tabulation: Bottom Up Memoization: Top Down One of the easier approaches to solve most… Read More » The post Memoization (1D, 2D and 3D)...
View ArticleLongest Common Subsequence | DP using Memoization
Given two strings s1 and s2, the task is to find the length of longest common subsequence present in both of them. Examples: Input: s1… Read More » The post Longest Common Subsequence | DP using...
View ArticleEdit distance and LCS (Longest Common Subsequence)
In standard Edit Distance where we are allowed 3 operations, insert, delete and replace. Consider a variation of edit distance where we are allowed only… Read More » The post Edit distance and LCS...
View ArticleLength of longest common subsequence containing vowels
Given two strings X and Y of length m and n respectively. The problem is to find the length of the longest common subsequence of… Read More » The post Length of longest common subsequence containing...
View ArticleMinimum Cost to make two Numeric Strings Identical
Given two numeric strings, A and B. A numeric string is a string that contains only digits [‘0’-‘9’]. The task is to make both the… Read More » The post Minimum Cost to make two Numeric Strings...
View ArticleCount common subsequence in two strings
Given two string S and Q. The task is to count the number of the common subsequence in S and T. Examples: Input : S… Read More » The post Count common subsequence in two strings appeared first on...
View Article