r/programming • • Sep 22 '20

Google engineer breaks down the problems he uses when doing technical interviews. Lots of advice on algorithms and programming.

https://alexgolec.dev/google-interview-questions-deconstructed-the-knights-dialer/
6.4k Upvotes

1.1k comments sorted by

View all comments

285

u/decimated_napkin Sep 22 '20

I firmly believe algorithmic programming interviews are being used as a proxy for an IQ test. Bottom line is companies dont care about getting the best candidate, they just want to make sure the candidate they do hire is good enough. By giving them questions that have to be studied on leetcode for a few months, you are essentially locking in a certain baseline intelligence and logical ability. For companies like Google this approach may be practical, but when a whole industry does this it just ends up being toxic in the long run.

263

u/[deleted] Sep 22 '20

I have a different take. Regurgitating solutions isn't as much an IQ test as a test of how much prep you've done. By giving tests requiring this much studying, the companies aren't testing IQ as much as willingness to put the time into preparation. They are, in effect, selecting for young and single developers who will be more willing to put in extra hours at work. Devs with a family are going to go home at the end of the day, and employers can use these tests as a fig leaf to filter them out.

61

u/AnalyticalAlpaca Sep 22 '20

I have a different take. Regurgitating solutions isn't as much an IQ test as a test of how much prep you've done.

100% this. When I was searching for a new job awhile back, I did so-so in the earlier interviews because I did basically 0 prep. As I continued to interview I learned the answers to more potential questions so I seemed a far better candidate, while in reality I had the exact same skills as the early interviews.

17

u/[deleted] Sep 22 '20

For the first couple interviews, I always pick my less desirable companies to get some practice.

66

u/decimated_napkin Sep 22 '20

I think it is probably both, can definitely see this side of it as well.

31

u/[deleted] Sep 22 '20

Also laziness. Why spend time coming up with something good and wasting HR man hours, when you can just copy what Google does?

6

u/GhostBond Sep 22 '20

I think one advantage for google is sabotaging their carbon copy competitors. Say 80% of good devs are thrown out by this process but 20% of them can pass it.

Google's carbon copy competitors also throw out those same 80%.

9

u/ichiruto70 Sep 22 '20

Eh kinda. A lot of people grind leetcode for years and still don’t get in. You still have to be smart to actually understand algo’s and why you would apply them.

9

u/[deleted] Sep 22 '20

True. These tests will filter out almost all poor coders. My point is that the tests will also filter out a lot of good coders who won't take the extra time to study the algorithms. This is fine with the employers, because that will tend to give them a young single workforce willing to put in long nights.

15

u/badtux99 Sep 22 '20

This. Age discrimination is illegal, but HR departments have figured out that they can do sideways age discrimination of this type to filter out older people and people with families (people who will cost more in terms of salary and benefits) and thus encourage it. Note that this isn't relevant to actual job performance -- in fact, there's actually a postive correlation between age and job performance (i.e., older applications generally perform better than younger applicants in the actual job), but that's not what HR is interested in. They're interested in reducing payroll costs. And they encourage practices on the part of hiring managers that will reduce payroll costs.

→ More replies (8)

15

u/[deleted] Sep 22 '20

As someone who has given lots of interviews, you'd be surprised how many people can answer these questions but can't write a method signature.

Really quite shocking. To that point though, interviewing is hard.

→ More replies (3)

5

u/eterevsky Sep 22 '20 edited Sep 22 '20

It's 50% a proxy to an IQ test, and 50% a sanity check for candidate's ability to turn a relatively simple algorithm into code.

15

u/KrypticAndroid Sep 22 '20

So what’s better?

81

u/serviscope_minor Sep 22 '20

So what’s better?

One of my favorite interview questions has at it's core an algorithm, but a simple one, and we start off with a quick discussion of the problem and how they might solve it. There's not a lot of choices on the algorithm because as I mentioned it's simple. This is mostly preamble so they have a mental framework for the next bit.

Then, we present them with some code which already implements it, except it's awful code, and has some bugs. Their goal is to refactor the code and make it clean. So they have to read and understand it, map it onto their understanding of the algorithm and make fixes. Many of the fixes are simple and can be done point-wise without fully understanding the code.

It's much more akin to day to day work of a software engineer. There's no trick to know or leap to make, it's just crappy code which needs fixing. It's telling for example if the candidates try to wing it, or add some basic tests, and whether their idea of "production code" is a profusion of classes.

18

u/[deleted] Sep 22 '20

I definitely agree that simple algorithms are better. Interviewers massively underestimate how hard something is when you don't already know the answer and have to come up with it on the fly. We "implement atoi" which seems to work quite well.

I like your refactoring idea - might steal it for the future. Although I did do one interview where they got me to write some code, and the feedback was that I didn't write enough tests. They didn't ask me to write any tests! So I think it does run the slight risk of candidates not knowing exactly what you want. I'll give it a go though!

→ More replies (4)

15

u/decimated_napkin Sep 22 '20

This is a much better method in my estimation.

→ More replies (3)

25

u/wy35 Sep 22 '20

I've heard Stripe does code pairs where you and the interviewer work together to fix a bug or implement a simple feature.

6

u/jlchauncey Sep 22 '20

We did this at rally. You came in and did a 2 hour long pairing session on the engineering floor. You had a set of problems you could choose from (game of life, check writing, maze building, and some others) and you and the other 2 engineers would work on it in any language you wanted.

it was by far the best part of the interview process because it told you a lot about how the interviewee worked and if they could handle our open office plan.

we actually had people turn us down because they couldnt work in our office env.

10

u/MishMiassh Sep 23 '20

Yeah, 100% turning down open floor code farms until that fad is gone.

→ More replies (6)
→ More replies (3)

12

u/LUV_2_BEAT_MY_MEAT Sep 22 '20

My company has you write a small simple program like fizzbuzz, then has you make changes/enhancements to it. For an example we might ask a junior dev:

  • Implement fizzbuzz

  • Now we need it to handle numbers 1 - 200

  • Now we need it to print "foo" on %7==0 and "bar" on %9==0

  • Now we also want to want to output not only to standard output but also to another interface

  • Now it reads the input number array from an HTTP get

Or whatever. The difficulty scales to experince level. I like this because thats what you'll do at your job - negotiate requirements, write code and maintain it. You'll get a feel at how good they are at writing maintainable code, as well as their views on testing/refactoring. We let them bring their own computers and do it in the own language/IDE if they want. We'd even let them google stuff if they asked.

11

u/nokoko Sep 22 '20

What would you do if you received 2k resumes per day, every day selected the best 100 to take your test and 90% of the candidates pass it with a perfect result? Who do you hire at the end of the month?

11

u/LUV_2_BEAT_MY_MEAT Sep 22 '20

The best cultural fit? The most relevant work experience? Other actually relevant things to the job?

6

u/nokoko Sep 22 '20

Does the job at your company involve anything harder that what is in the test, or is it a good representation of the complexity in the day to day work? If that's the case then you don't need to hire the best engineers, so the approach is understandable.

The challenge in hiring at big companies is that you want to present a hard problem (they want the best engineers) that can be completed quickly (people's time is valuable) and does not weed out people because they lack some exact domain knowledge. There are not many of such problems.

7

u/LUV_2_BEAT_MY_MEAT Sep 22 '20

But thats the whole problem: DS/A questions don't give you the best engineers, they give you the people who are best at solving DS/A questions. DS/A is a learned and practiced skill. Theres a whole industry now in getting better in those types of questions that exists for the sole purpose of doing well in these interviews. While these types of questions might provide partial insight into their abilities, things like technical discussions are equally telling: describing past projects, why the did the things they did, why they chose the technologies they chose, what didnt work, what they'd do differently, etc. The coding exercise I described is part of that holistic approach. I know you mentioned people's time is valuable, but again, if you don't take a little more time you dont want the best engineer - you want the best DS/A solver.

→ More replies (1)
→ More replies (4)
→ More replies (8)
→ More replies (15)