Skip to content

Instantly share code, notes, and snippets.

@puffin
Created February 15, 2017 14:12
Show Gist options
  • Save puffin/59434efaccdb52842d517a9a053882d1 to your computer and use it in GitHub Desktop.
Save puffin/59434efaccdb52842d517a9a053882d1 to your computer and use it in GitHub Desktop.
Longest common subsequence

CHALLENGE DESCRIPTION:

You are given two sequences. Write a program to determine the longest common subsequence between the two strings (each string can have a maximum length of 50 characters). NOTE: This subsequence need not be contiguous. The input file may contain empty lines, these need to be ignored.

INPUT SAMPLE:

The first argument will be a path to a filename that contains two strings per line, semicolon delimited. You can assume that there is only one unique subsequence per test case. E.g.

XMJYAUZ;MZJAWXU

OUTPUT SAMPLE:

The longest common subsequence. Ensure that there are no trailing empty spaces on each line you print. E.g.

MJAU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment