To Find the next Fibonacci Number of given numbers.

Fibonacci...

What's that??

Still most of interviewers favorite topic is from fibonacci series..

Formula : 



Now the Question is

Write a function that takes an array of integers as input. For each integer, output the next fibonacci number. Solution that work both cpu and memory efficient are appreciated.

For example:
nextFibonacci([1,22,9])

Output:
2
34
13

Answer:

Get it from Github Gist

If anybody knows some better solution these, please comment in this post.

Comments

Popular posts from this blog

Flutter Bloc - Clean Architecture

What's new in android 14?

Dependencies vs Dev Dependencies in Flutter