title: Improve C++ Fibonacci series
body: <p>I know that:</p>
  
  <pre><code>int fib(int n) 
  {
      if (n == 0 || n == 1)
          return 1;
  
      return fib(n − 1)+ fib(n − 2);
  }
  </code></pre>
  
  <p>when n=5，fib(5) evaluates as:</p>
  
  <pre><code>fib(5)
  fib(4) + fib(3)
  (fib(3) + fib(2)) + (fib(2) + fib(1))
  ((fib(2) + fib(1)) + (fib(1) + fib(0))) + ((fib(1) + fib(0)) + fib(1))
  (((fib(1) + fib(0)) + fib(1)) + (fib(1) + fib(0))) + ((fib(1) + fib(0)) + fib(1))
  </code></pre>
  
  <p>Notice that each base element being used for several times, is there a way to use map to store the previous value and simply do fib(n − 1) + fib（n − 2)?</p>