Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lcs :: (Eq a) => [a] -> [a] -> [a]
- lcs [] _ = []
- lcs _ [] = []
- lcs (x:xs) (y:ys) =
- if (x == y) then x : lcs xs ys
- else longer (lcs xs (y:ys), lcs (x:xs) ys)
- where longer (a, b) = if (length a > length b) then a else b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement