Google Interview Question
SDE1sCountry: United States
the question is totally unclear, the 2^32th fibonacci number is extremly large, a number with roughly 1 Billion digits. Even NoOnes refered closed form formula will never calculate it in O(1) unless n is considered to be a constant (2^32) which is a bit silly. In the other hand the question could be interpreted as well as telling for any number between 1 and 2^32 wheter it is a Fibonacci, which then is very easy, since there are 46 fibonacci numbers in this range and those can easily be precalculated.
Here is how to do a fast Fibonacci.
- NoOne December 22, 2017[ stackoverflow.com/questions/6037472/can-a-fibonacci-function-be-written-to-execute-in-o1-time ]