• + 2 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