News for hackers. Stuff that matters.
Re:An Algorithm for Passing Programming Interviews (2020) by angarg12 on Monday January 03, 2022 @04:02AM (#29778760)
Almost all advice online about interviewing is written from the point of view of the candidate. Sometimes this is good advice, but sometimes it devolves into some kind of astrology, where candidate are just guessing how things work.

I've done +300 interviews at FAANG so I can share bit of advice from the interviewer's side. The caveat is that this is based on how I conduct interviews, so YMMV with other people.

* Always ask clarifying questions. Almost all problems have some level of ambiguity that you need to clarify. This is intended. The more senior you are, the more important this becomes.

* Explain your approach before you begin, and even while you code. This gives the interviewer a chance to help you if you are down the wrong path, or even just understand what you are up to.

* If you get stuck, ask for help! think of this as a pair programming session rather than an interview. I much prefer a candidate who gets stuck, ask for hints, gets unblocked and writes good code, rather than one that doesn't ask for help and writes not-so-good code.

* Caveat: There is a tension with asking questions. There is such a thing as too much help, e.g. I need to explicitly tell you how to solve the problem. Use judiciously.

* Take interviewer's hints. The interviewer has probably asked this question dozens of times and knows it inside out. If they give you a hint, 99% of times they are on to something.

* Personally I don't like "hard LC" problems. Instead I prefer medium difficulty problems, and spend extra time probing the candidate's coding skills. This includes:

1. Write tests.

2. Handle corner cases/incorrect inputs.

3. Discuss how to scale the code.

4. Discuss how to refactor the code.

* If nothing else, write the simplest brute force solution you can think of. As an interviewer I need a coding sample to evaluate the candidate. Trying to and failing to implement an optimal solution is worse than implementing a correct brute force one.

Re:An Algorithm for Passing Programming Interviews (2020) by xtracto on Monday January 03, 2022 @11:32AM (#29782519)
> and even while you code

As an interviewer I explicitly ask candidates NOT to do this (or only doing it if they want). For some reason there is this expectation in coding interviews. I challenge anyone that pushes their interviewees to do this, to sit down during one of their own coding sessions and vocalize the stuff they are coding while doing it. In my opinion it is stupid, and unnecessary.

When my interviewees start solving the coding tests and begin "thinking out loud" I told them: "you don't need to do this here, focus on your code, and once you are done I'll ask you to explain some parts to me". I invariably listen to a huge breath of relief from them haha.

Re:An Algorithm for Passing Programming Interviews (2020) by albrewer on Tuesday January 04, 2022 @11:24AM (#29796552)
Luckily my problem-solving thought process is already like conversation so just saying out loud what I'm thinking is just vocalizing what's already going through my head.

The more I read HN comments the more I realize that not everyone reasons through problems "verbally" (even if it's silent or internal) and uses some other thought process. To me, coding has always been like speaking a very specific and pedantic language.

I would find it interesting if other people were able to share their own mental models for coding, if that's even possible.

Re:An Algorithm for Passing Programming Interviews (2020) by bradlys on Monday January 03, 2022 @01:19PM (#29784146)
You’re rare as far as expectations go in the Bay Area. Most interviewers want explanations the whole way. Basically don’t stop talking ever.
Re:An Algorithm for Passing Programming Interviews (2020) by mettamage on Monday January 03, 2022 @08:00AM (#29780319)
I appreciate the caveat. Caveats are almost never given when people give advice and it is exactly the thing that people get stuck on when they take the advice to heart.
Re:An Algorithm for Passing Programming Interviews (2020) by Jaygles on Monday January 03, 2022 @08:46AM (#29780706)
Have you ever passed someone who wrote brute force algorithms?
Re:An Algorithm for Passing Programming Interviews (2020) by angarg12 on Monday January 03, 2022 @10:18AM (#29781556)
Of course. Contrary to popular belief you don't need to ace all interviews to get an offer.

It's fairly common to make a hire decision with one person not inclined.

Re:An Algorithm for Passing Programming Interviews (2020) by emotional_fool on Monday January 03, 2022 @01:00PM (#29783878)
So your assessment was "inclined no hire" when the person gave brute force solution, am I wrong?
Re:An Algorithm for Passing Programming Interviews (2020) by angarg12 on Monday January 03, 2022 @04:01PM (#29786824)
Most often, but not always.

To understand why here is another bit of my philosophy: the aim is to find a good match between candidate and company. The interview is a (very flawed) proxy for this, so don't overindex on it.

For instance, recently I was inclined for a candidate although he didn't make it past brute force. The reason is that he did very well in the behavioural round, and wrote a very good brute force solution. Also, during coding, he explained in detail the internals of some data structures (e.g. hash maps), which shows they know their stuff. Lastly, they had an intuition about how to approach the problem optimally, even if they didn't manage to write the code.