Longest Common Subsequence Again
Practice
3.8 (6 votes)
Dynamic programming
Algorithms
Medium
Dynamic programming
Problem
89% Success 2091 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given two strings S, P and two integers, \(K1\), \(K2\). You have to find the length of the longest common subsequence after performing at-most \(K1\) operations on string S and at-most \(K2\) operations on string P. In one operation, you can change a character of the string to any alphabet.
INPUT FORMAT :
First line contains a string, S .
Second line contains a string, P.
Third line contains two space separated integers, \(K1\) and \(K2\) .
OUTPUT FORMAT :-
Print the length of the longest common subsequence after performing at-most \(K1\) operations on string S and at-most \(K2\) operations on string P.
CONSTRAINTS :-
Submissions
Please login to view your submissions
Similar Problems
Points:30
15 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsDynamic ProgrammingDynamic programming
Points:30
6 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsDynamic Programming
Points:30
2 votes
Tags:
Binary search algorithmDynamic ProgrammingMediumAlgorithmsDepth-first searchDynamic programmingDisjoint set
Editorial