public long getIterative(long n) {
    validateInput(n);

    if (n <= 2) {
      return 1;
    }
    long previous = 1;
    long current = 1;
    long element = 0;
    for (long i = 3; i <= n; i++) {
      element = previous + current;
      previous = current;
      current = element;
    }
    return element;
  }
Iterative approach. The complexity order in this algorithm is O(N) where N is the integer used
as parameter. In space terms, the complexity order of this algorithm is again O(1).
src/main/java/com/github/pedrovgs/problem7/FibonacciNumbers.java