I recently got to code a list as an interview coding exercise from one of the FAANGs. I thought that it might be a good idea to post it there for future reference.
I went for a recursive and immutable implementation. It's quite naive and I would certainly not use it in production, but as an exercise it was fun writing it due to its elegance.
If you look at the list implementation in Scala 2.12, they went for an imperative solution for most methods... Elegance sometimes comes at too high a price in terms of performance!
So... Do I pass the Fizz Buzz test?
I went for a recursive and immutable implementation. It's quite naive and I would certainly not use it in production, but as an exercise it was fun writing it due to its elegance.
If you look at the list implementation in Scala 2.12, they went for an imperative solution for most methods... Elegance sometimes comes at too high a price in terms of performance!
So... Do I pass the Fizz Buzz test?