12

So I was interviewing today with one of the Big 4 tech giants and I was asked an algorithmic question. Before I start explaining my solution, I ran through all the famous data structures in my head and had a very clever idea of using a Map which reduced my naive solution from O(N^2logN) to O(N). I proceeded to explain my solution clearly and coded it up. The interviewer asked some followup questions about them and he said that this was indeed the optimum solution.

Now after I finished the interview, I started getting worried because I am wondering if the interviewer would think that I knew this question from before and just wrote down the answer I know. Do interviewers generally think that anybody who gets the optimum solution from the start has most likely seen this question before?

EDIT: I got the internship :). I guess I got my answer.

5
  • 1
    What Joe said. Interview questions are as much a filter for them as they are for you. Anyone who rejects you for coming up or remembering the optimal solution for their interview problem is probably doing you a favor...
    – Kempeth
    Commented Jun 27, 2017 at 6:12
  • 3
    Congratulations! ;) Commented Jun 28, 2017 at 8:04
  • 2
    Statistically speaking, even when the question cannot be known before, some of the applicants (if there are enough of them) should come up with the optimal solution (even if it is more by chance than by knowledge).
    – skymningen
    Commented Jun 28, 2017 at 9:12
  • Well, this is 6 years after the fact. I'm curious if the OP ever actually used Map in an actual deployed solution during their time there.
    – Nelson
    Commented Dec 14, 2023 at 6:15
  • 1
    @Nelson Yes? Many, many times? Commented Dec 14, 2023 at 20:49

3 Answers 3

14

Do interviewers generally think that anybody who gets the optimum solution from the start has most likely seen this question before?

Possibly, but it doesn't really matter. The typical interview process is not really about knowing (or not knowing) specific answers; from an employer's perspective it's about whether you have knowledge and experience in a given problem domain, and if you can solve the business problems that they face.

If you've seen a problem before and know the answer, that's called "knowledge." Employers want knowledge. If an employer is asking knowledge questions, then being knowledgeable is an asset.

However, sometimes overly-clever solutions or memorized answers are unsuitable for solving real-world problems. Being pragmatic and being able to apply previously-learned knowledge to new problems is called "experience." Employers value experience. If an employer is asking problem-solving or experiential questions, then being experienced is an asset.

Some interviewers rely on tricky questions to filter people out of the hiring pipeline, but you'll never fail an interview for being knowledgeable or experienced. The follow-up questions were likely designed to ensure you had given an answer from real knowledge or experience, rather than luck or rote. If you demonstrated either knowledge or experience in your follow-up answers, no reasonable1 interviewer would see a correct answer as a negative.


1   Obviously, if the interviewer is unreasonable or insane, all bets are off. Back away very, very slowly. When you have safely exited the building, find another company to work for.

6

As an interviewer (and also when I have been an interviewee) this is not a bad thing. It happens from time to time. At most, it may be a problem for your interviewer, as he will need to adjust the flow of the interview slightly - but that's his problem, not yours.

From your side, the important things should be:

  • Did you explained thoroughly how to reach to your solution?

  • Did you wrote a reasonably clean (and good) code?

  • Did you address properly the follow-up questions?

  • Did you behave properly during the interview? (i.e. friendly, not boasting too much about knowledge... you know, not being that guy)

If so - and it seems you did from your description - you shouldn't be worried at all. Business rules sometimes dictates that a technical interview must follow a path (thinking, naive solution, discussion, improvements...) and take a given amount of time, but all that is still arbitrary.

And IMHO, when I have in front of me a candidate able to cut to the chase and solve the problem flawlessly, the last thing in the world I am going to do is to provide negative feedback.

5

Do interviewers generally think that anybody who gets the optimum solution from the start has most likely seen this question before?

I used to do coding interviews, with similar types of problems. If a candidate would get a perfect answer quite quickly that usually would not be a problem, and we would figure out whether that is a memorized answer by doing the following:

  • Ask the candidate how they got to the solution and why they made certain choices
  • Modify the question on the fly to make it harder: "What if the input string didn't fit in the memory?", "What if there are circles in the graph?", "What if negative inputs were allowed?"
  • Ask the candidate about details of the methods used. "You have been using a heap, can you explain more about heaps?"

Usually a candidate who aced the basic question would to reasonably well on the follow-ups, someone who just memorised an answer from a website offering solutions to our interview questions would stumble on the follow-ups.

So in the end, it depends on how someone does for the rest of the interview if they solve the first problem in 10 minutes.

2
  • Are you saying "interviewers typically ask follow-up questions if they are unsure"? Or how would this help OP if your company does it?
    – guest
    Commented Dec 19, 2023 at 11:38
  • I don't know the interview processes of most companies, but I would expect them to do so, yes. I haven't heard of an interview where after 10 of 60 minutes of allocated time the interviewers would go. "That's enough, you did perfectly and you failed, because it was too good."
    – Helena
    Commented Dec 19, 2023 at 12:26

You must log in to answer this question.

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