You are viewing a single comment's thread. Return to all comments →
Hello! I wonder why is this solution is better than mine:
def recursiveZip(l1: List[Char], l2: List[Char], acc: List[Char]): List[Char] = { if(l1.isEmpty) acc else recursiveZip(l1.tail, l2.tail, acc ++ List(l1.head, l2.head)) }
It is tail recursive function, list concatenation has linear complexity
Seems like cookies are disabled on this browser, please enable them to open this website
String Mingling
You are viewing a single comment's thread. Return to all comments →
Hello! I wonder why is this solution is better than mine:
It is tail recursive function, list concatenation has linear complexity