Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write simple python/java program and also explain the logic because i am crying so much and not able to understand anything. Generating Sequence: You are

Write simple python/java program and also explain the logic because i am crying so much and not able to understand anything.

Generating Sequence: You are given two strings A of length N and B of length M. These strings contain lowercase English alphabets. You are also given an integer K. You can change the character of x string A to any other characters y. The cost of this conversion is abs( ASCII(x)- ASCII(y) ). Find the minimum cost required such that the length of the longest common subsequence (LCS) of A and B is at least K.

Note:

  • A subsequence of A string can be obtained by deleting zero or more characters in A.
  • The longest common subsequence of two strings of A and B is a subsequence of A and B and has the maximum length among all strings that are a subsequence of A and B that would be multiple subsequences for two provided strings for example an LCS of vera and eats is ea.

Input Format:

  • The first line contains an integer T denoting the number of test cases for each test case.
  • The first line of each test case contains three space-separated integers N, M, and K.
  • The next line of each test case contains a string A.
  • The next line of each test case contains a string B.

Output format: For each test case, print the minimum cost required in a new line.

Constraints

1 T 10

1 N, M 200

0 K min( N, M )

Example:

Input: 2 5 4 3 abcba acyx 3 3 3 abc abc Output: 22 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

10-9 How have social technologies changed e-commerce?

Answered: 1 week ago