Pergunta de entrevista da empresa MathWorks

Describe how you would code a Fibonacci series (not actually unexpected, pretty standard)

Respostas da entrevista

Sigiloso

3 de abr. de 2013

The trick is to ask how many terms you need; the series is recursive so you need to show that you realize that certain ways of doing it will eat huge amounts of processor power.

Sigiloso

15 de mar. de 2016

cout> n; int firstterm = 0, secondterm = 1; cout << firstterm << "," << secondterm << ","; int nextterm = firstterm + secondterm; for(int i = 1; i < n - 1; i++) { cout << nextterm << ","; firstterm = secondterm; secondterm = nextterm; nextterm = firstterm + secondterm; }