Pergunta de entrevista da empresa MathWorks

Write an algorithm for generating the Fibonacci sequence and how would you optimise it.