r/programming • • May 08 '15

Five programming problems every Software Engineer should be able to solve in less than 1 hour

https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k Upvotes

2.1k comments sorted by

View all comments

Show parent comments

1

u/rocky_whoof May 08 '15

Fibonacci is a terrible example of recursion, and if this is the way you go about it you're going to have a bad time (well, an out of memory exception). Even with limitless memory available, doing it naively for the 100th number is unfeasible strictly for time constraints.

The "trick" is dynamic programming. And it's not a trick, it's actually a very useful algorithmic approach. I'd rather have someone know what it is than simply memorize it strictly for this particular interview question, but even the latter is better than someone who has no idea what this is.

1

u/Otis_Inf May 08 '15

Though dynamic programming isn't going to solve the overflow when you near 100 ;)

1

u/rocky_whoof May 08 '15

Is it because you need more than 64 bits to represent the number?

Well, that's not a problem in python...