you can store the two strings in an upside down suffix tree. a simple
edge scan of common path will give you all possible (and largest)
common substring
Think of the negative numbers as consumers from a warehouse and
positive numbers as producers from the warehouse. The problem reduces
to plotting the inventory (starting from time = 0 to time = n) and then
finding the max amplitude over time axis in +ve quadrant of the
inventory profile which can
In perl (hopefully the homework has been due already)...
use strict;
our %memo;
sub lcs {
my ($x, $y) = @_;
my $key = $x|$y;
return $memo{$key} if defined $memo{$key};
my $s = '';
for (my $i = 0; $i length($x); $i++) {
for (my $j = 0; $j length($y); $j++) {
if
Thanks a lot Jeff and Mattia I'll get back as soon as I have studied
some
Rohit