## unknown Interview Question

Software Developers**Country:**India

**Interview Type:**Written Test

This is the most efficient code that I can make ( O(n) ):

```
public int fib(int n){
int nMinus1 = 1;
int nMinus2 = 1;
for(int i = 1; i < n; i++){
int temp = nMinus1 + nMinus2;
nMinus2 = nMinus1;
nMinus1 = temp;
}
return nMinus1;
}
```

This program is to generate fibonacci series, but the op is asking for the fibonacci prime.

Shortest code, but FAR from most efficient.

- zortlord August 19, 2015