Hacker News new | past | comments | ask | show | jobs | submit login

In java: public int nth_fibbonacci(int n) { if (n == 0 || n == 1) return 1; return nth_fibbonacci(n-1) + nth_fibbonacci(n-2); } //Would you accept that as a valid response even though it is terribly inefficient? It's what I came up with in 5 minutes.



Yep, that would work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: