Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sumuj (list1:List[Int],list2:List[Int]):List[Int]= {
- def sumuj_2(l1:List[Int],l2:List[Int],temp:List[Int]):List[Int]=
- (l1, l2) match {
- case (Nil,Nil) => temp.reverse
- case (Nil,_) => sumuj_2(l1, l2.tail, l2.head::temp)
- case (_,Nil) => sumuj_2(l1.tail, l2, l1.head::temp)
- case (_,_) => sumuj_2(l1.tail, l2.tail, (l1.head + l2.head)::temp)
- }
- sumuj_2(list1,list2,Nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement