C++
class Solution{
public:
/**
* @param n: an integer
* @return an integer f(n)
*/
int fibonacci(int n) {
// write your code here
int a=,b=;
for (int i=; i<n; i++) {
a = a+b;
b = a-b;
}
return a;
}
};
C++
class Solution{
public:
/**
* @param n: an integer
* @return an integer f(n)
*/
int fibonacci(int n) {
// write your code here
int a=,b=;
for (int i=; i<n; i++) {
a = a+b;
b = a-b;
}
return a;
}
};