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.