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

Clear the app data programmatically in android

Proguard usage in Android

Singleton classes