public long getRecursiveWithCaching(int n) {
    validateInput(n);

    if (n <= 2) {
      return 1;
    } else if (elements[n - 3] != 0) {
      return elements[n - 3];
    }
    elements[n - 3] = getRecursiveWithCaching(n - 1) + getRecursiveWithCaching(n - 2);
    return elements[n - 3];
  }
This version of the recursive algorithm is better in performance terms because we are caching
every calculated element to avoid every branch of the recursion the same values. Is faster
because one branch is going to take the already calculated value from other branches and when
you are going to calculate the 11th value the only thing you have to calculate is to take
previous values from the array instead of iterate from nth to 1 and sum every value. I've used
a dynamic programming technique.

The problem with this algorithm is related with the space complexity which is much bigger than
the one used for the previous algorithms. In this case, we have O(N) because we are using an
additional data structure to store partial results.
src/main/java/com/github/pedrovgs/problem7/FibonacciNumbers.java