Sometimes somebody asks a question, but the answer they’re looking for is not the answer to the question; it’s the answer to the question behind the question.
My 3 year old daughter demonstrated this recently in a conversation with my wife. After realizing we didn’t know where in the house she was, and having a statistically unrealistic duration of peaceful silence in a house with a toddler, my wife suspiciously called out:
Mom: “Oh [Daughter #1], where are you?”
Daughter #1: “Uh … , I’m not getting into trouble”
The same concept happens in interviews.
For example, the interviewer asks a simple coding question such as “write a function to compute the Fibonacci series (0,1,1,2,3,5,8,13…)” in [primary language the team writes in]. What they probably are really asking is “can you write actual code without having a heart attack?”, and they probably expect you to ask some clarifying questions (eg, iterative vs. recursive) and answer it in under 3 minutes. Then they can move onto the real questions.
That’s probably not the time to show that you can pull out the math kung-fu to convert the algorithm from O(n) to O(1) (closed form).