Pergunta de entrevista da empresa Meta

Fibonacci: recursive and iterative.

Respostas da entrevista

Sigiloso

15 de ago. de 2014

// Iterative public static long getFibIterative(int n){ int prev1 = 1; int prev2 = 1; // it's like 1 1 2 3 5 8 // prev1, prev2, 2 3 5 8 // let i be the index for(int i=2; i

6

Sigiloso

15 de ago. de 2014

// Recursive public static long getFib(int n){ if (n <=1) return n; return getFib(n-1) + getFib(n-2); }

3

Sigiloso

26 de fev. de 2021

It's essential to demonstrate that you can really go deep... there are plenty of followup questions and (sometimes tangential) angles to explore. There's a lot of Software Engineer Intern experts who've worked at Facebook, who provide this sort of practice through mock interviews. There's a whole list of them curated on Prepfully. prepfully.com/practice-interviews