Given the following List:
val l = List(List(1, 2, 3), List(4, 5), List(6, 7, 8))
If I try to transpose it, Scala will throw the following e
How about this one-liner using the Scala's standard Api:
((l map (_.toArray)) toArray).transpose map (_.toList) toList
This gets the job done and is O(N*M), where N is the length of the wrapper list and M is the length of the longest list inside the wrapper list.
O(N*M)
N
M