Pregunta de entrevista de Goldman Sachs

Fibonacci implementation

Respuestas de entrevistas

Anónimo

17 feb 2012

//Fibonacci Sequence Generation using Recrusion Ex. /* Fib(0) is 0 [base case] * Fib(1) is 1 [base case] * For all integers n > 1: Fib(n) is (Fib(n-1) + Fib(n-2)) [Recursive definition] */ public int GenerateFibonacci(int count) { if (count <= 1) return 1; else return GenerateFibonacci(count - 1) + GenerateFibonacci(count - 2); }

4

Anónimo

14 may 2011

I got the same f-ing question today

1

Anónimo

8 jun 2011

Chetan Trikha is a no gooder vice president of Goldman, who has learnt fibonnaci in school and has never used it, and is asking candidates to implement it, whereas nobody can on the fly.

2