Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def matchTwoLists(xs:List[Int], ls: List[Int]): List[Int] = {
  2. (xs, ls) match {
  3. case (Nil, Nil) => Nil
  4. case (head::tail, Nil) => head :: matchTwoLists(tail, Nil)
  5. case (Nil, head1::tail1) => head1 :: matchTwoLists(Nil, tail1)
  6. case (head::tail, head1::tail1) => head :: head1 :: matchTwoLists(tail, tail1)
  7. }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement