Longest Common subsequence

Source: Internet
Author: User

Longest Common subsequence
Maximum public subsequence time limit: 3000 MS | memory limit: 65535 KB difficulty: 3

The description will not go around. For example, what you need to do is to write a program to obtain the longest common subsequence.
Tip: The Longest Common Subsequence is also called the Longest Common substring (not consecutive). It is abbreviated as LCS (Longest Common Subsequence ). It is defined as a sequence S. If it is a subsequence of two or more known sequences, and it is the longest of all sequences that meet this condition, S is the longest common subsequence of known sequences.
Input the first line to give an integer N (0 Next, two rows of data in each group are the strings to be tested. The length of each string is not greater than 1000. An integer is output for each group of test data, indicating the maximum length of the common subsequence. Each result group occupies one row. Sample Input
2asdfadfsd123abcabc123abc
Sample output
36




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.