4

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.

3
  • Sigh. I would really prefer to discuss this question on programmers.se.com or SO, because nuances of the problems are important here. The linked duplicate candidate is not the same -- it is talking about extremely simple and truly well known problems. I'm talking about significantly harder and less common ones. Unfortunately question got deleted from programmers.se. I hate SE fragmentation nazis.
    – MK.
    Nov 3, 2016 at 1:06
  • 3
    (Full disclosure: the accepted answer on the linked question is mine.)Your question is about how to behave when you already know a solution to the problem you have been given, regardless of its nature. The other answer still applies: You tell them that you have a solution to that problem, and you show them what it is. Believe it or not, you can actually get to a higher level of dialogue about problem solving in general if you don't have to spend time working out a solution. It's a better interview for everyone involved.
    – Kent A.
    Nov 3, 2016 at 1:21
  • @MK. The problem is, with the nuances, it becomes less applicable to most people and becomes a poor question. Being honest is definitely the best approach, so you let the interviewer lead the question afterwards. I'm sure you can see how prepared the company is when you observe how they handle this situation.
    – Nelson
    Nov 3, 2016 at 1:51

2 Answers 2

8

You can admit you know the problem. It shows experience, confidence, and knowledge. Then nail the solution, correctly, with as little embellishment as possible, basically stating the answer. You'll look seasoned.

4

Just solve the problem. You won't come off looking like a genius if the interviewers are competent, you'll come across as someone who prepared well and has experience.

I'm not a programmer but I have so much experience as an engineer that I have often made problems seem trivial even after a team of guys have been trying to work it out for half a day. Professionals even in other fields recognise this as experience, not genius.

2
  • Eh, take a look at maximum subarray problem. I think you have to be pretty damned smart to be able to solve it quickly first time you see it.
    – MK.
    Nov 3, 2016 at 1:47
  • 1
    @MK. I don't doubt that, but if you've seen the exact or very similar issue before and struggled with it for a day, it isn't so difficult the next time... that's my point.
    – Kilisi
    Nov 3, 2016 at 1:50

Not the answer you're looking for? Browse other questions tagged .