This question already has an answer here:
I frequently get asked "classic" questions during coding interviews and I am always confused how to handle myself in these situations. Of course I'm not talking about the warmup questions like "reverse a string" or "fizzbuzz", but non-trivial one, like a harder puzzle, or an algorithm (e.g. today I was asked to implement the maximum subarray problem). I feel that if I just write out a solution to a harder problem like that on the whiteboard I will be misleading the interviewer into thinking I am a genius I am not. Faking a slow thinking process seems dishonest and wrong. Saying flat out "I know how to do this because Glassdoor says you ask this question" is also not ideal... Note: I am specifically asking about hard and not super-widespread problems.