#include <iostream>
#include <unordered_map>
int fib(int n) {
std::unordered_map<int, int> memo {};
if (n < 1) return 0;
if (n < 3) return 1;
if (!memo.count(n)) {
memo[n] = fib(n-1) + fib(n-2);
}
return memo[n];
}
int main() {
for (int i=1; i<15; i++) {
std::cout << fib(i) << '\n';
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: