in reply to Re: Re: Finding largest common subset in lists?
in thread Finding largest common subset in lists?

I'm stupid, stupid, stupid. There should be:

.... if ($end > @result) { @result = @a[0..$end-1]; } ...
instead of
... if (--$end > @result) { @result = @a[0..$end]; } ...
The way I have it I'd only update the @result if the newly found list was longer by at least 2 items. The usual off-by-one error :-(

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature