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(list1:List[Int],list2:List[Int],temp:List[Int]):List[Int]=
- (list1, list2) match {
- case (Nil,Nil) => temp.reverse
- case (Nil,_) => sumuj_2(list1, list2.tail, list2.head::temp)
- case (_,Nil) => sumuj_2(list1.tail, list2, list1.head::temp)
- case (_,_) => sumuj_2(list1.tail, list2.tail, (list1.head + list2.head)::temp)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement