Ad
  • Default User Avatar

    No, it just felt natural to me. Fibonacci has always been a prime example for recursiveness, so it was obvious to me to use recursion here too.

    As a matter of fact, depending on how R handles function call stacks and function invocation overhead, it's most likely less performant than other solutions. But (at least to me), it's just more "elegant" to read and clearer to understand the algorithm behind it.

  • Default User Avatar

    If I may ask - any reason why you chose this solution? Something about code speed maybe?

  • Default User Avatar

    Man, this was messing with my head. Love your extra effort to work without loops! :)