Earlier quoted context omitted.
I recently interviewed a candidate with a degree in computer science. He was unable to explain to me how he would have implemented the Fibonacci sequence without chatGPT. We never got to the question of recursive or iterative methods. The most worrying thing is that the LLM were not very useful three years ago when he started university. So the situation is not going to improve.
I’m 10 years in software and was never bothered to remember how to implement it the efficient way and I know many programmers who don’t know even the inefficient way but kick ass. I once got that question in an interview for a small startup and told the interviewer: with all due respect what does that have to do with the job I’m going to do and we moved on to the next question (still passed).
If someone tells you not to do it recursively, you should be able to figure that out too.
Interview nerves might get in your way, but it’s not a trick question you need to memorize.