I\'m working on an algorithm to calculate a Fibonacci number and got the pseudo code for it but I can\'t figure out how much time it takes to run. I think it runs at O(n) but no
Yep. The big giveaway is that you have a constant number of operations per loop and the size of your loop is linear against the size of n.
A more space-efficient solution exists, however, since you don't particularly care about any numbers other than the last two. Try that next!