Fastest way to calculate Fibonacci number

Yeaah! :slight_smile:

I used it in a contest where n<=10^18, and I got AC :slight_smile:

ig this one is better than fast doubling as it can be easily applied to diff variations of this que.
As @prmondal said

But I think in your exam time limit is more bcz 10^18 is very big range…

Time limit was 1 second. It was HMC contest, I guess even Abdullah used the same code in that contest. I’ll check it out :slight_smile:
Log(10^18) is not that time consuming :slight_smile:

But how can u implement sieve of this long range

We are calculating fibonacci numbers, not prime numbers…

Oh sry sry…wrong context…