|
|
|
|
|
by taeric
4743 days ago
|
|
Correct me if I'm wrong, but this is also O(n) in space, right? I think you can get a similar scala version in: lazy val fib:Stream[BigInt] = 0 #::1 #:: fib.zip(fib.tail).map(x=>x._1+x._2)
This is neat and all, but the imperative version wins by being O(1) in space. Right? |
|