r/programming • • Mar 01 '17

Programmers are confessing their coding sins to protest a broken job interview process. “Whiteboard” interviews are widely hated. They also discriminate against people who are already underrepresented in the field.

https://theoutline.com/post/1166/programmers-are-confessing-their-coding-sins-to-protest-a-broken-job-interview-process
1.0k Upvotes

717 comments sorted by

View all comments

Show parent comments

2

u/quicknir Mar 01 '17

I've asked, for instance, for someone to give me a data structure that you can push values into, and allows me to get the median in O(1) time. Sometimes people have seen it before, but usually they haven't. It gives me a chance to see that they can come up with a slow solution very quickly. That they have basic understanding of big O. See what data structures they think would be useful. If they don't see they need 2 heaps, I'll give them some subtle hints, and then bigger ones. Once they get the idea I start asking for details of the functions, branches in the logic. I ask if the class is maintaining invariants and what they are.

Maybe 5% of people admit they have seen it. Another 5% solve it quickly enough or in such a way that I suspect they may have seen it but not admitted it. In any case this is no big loss as it only takes about 5 minutes and I ask something else. Probably 10-15% do what I would consider a good job. They get the easy parts on their own, they make good use of hints, communicate well, describe correct logic and invariants, etc. A quarter or a third of people just do terribly; even with progressively larger hints they cannot make any independent progress. It usually takes me an hour to get someone through the problem in this case, and I don't need to ask them anything else because they are an easy reject. The remaining people (about half), do ok. My review would then depend on many other factors like other questions I asked them, their relevant experience and our discussion of them, whether it seems like they'll be easy to get along with, etc.

I'm pretty sure that this question, conducted well, provides a good amount of valuable information on candidates and I'm pretty happy with it. Being able to reject about a quarter of people with an interview I have put minimal time into preparing is already pretty good. And no, I don't shed any tears for those programmers; I hint pretty generously and I honestly expect that for a competent programmer that should be enough.

I know dozens of similar problems. The details of the problem are not really the key thing. As long as the difficulty of the problem is reasonable, you can learn quite a lot as long as you do a good job interviewing and try to explore various interesting things with the candidate and don't just frame it in a shitty Q&A format.

3

u/Poddster Mar 01 '17

I've asked, for instance, for someone to give me a data structure that you can push values into, and allows me to get the median in O(1) time. Sometimes people have seen it before, but usually they haven't. It gives me a chance to see that they can come up with a slow solution very quickly. That they have basic understanding of big O. See what data structures they think would be useful. If they don't see they need 2 heaps, I'll give them some subtle hints, and then bigger ones.

Why'd you need two heaps? You just need a count + tree? If your tree sorted on each input (aka a heap?), then the middle value (the median) is the root node? (or for odd counts, it'll be root+left/2 or root+right/2 or something)

3

u/quicknir Mar 01 '17

A count and a tree doesn't quite work out. No BST implementation that I'm aware of is so balanced that you can assume the root is the median. And even then, the left and right children are not the values one above or one below the median. For instance, the right child of the left child, is larger than the left child but still less than the root, so it's closer to the root.

To make a long story short it is possible to do it with a single binary search tree by taking advantage of the fact that BST iterators are not invalidated on insertion. In my experience this solution is harder to come up with than two heaps.

3

u/Mehdi2277 Mar 02 '17

The simple way to do it with a BST is to use an AVL tree that keeps track of the left and right subtree sizes. You can then recurse to the side that contains the median. Technically this is O(log n), but you can also keep track of the median explicitly and just update it whenever you do an insert without slowing down insert asymptotically. The name of using a tree that also keeps track of things like medians is an order statistic tree.

2

u/mikulas_florek Mar 01 '17
vector<int> values;
void push(int value) { values.push_back(value); sort(values); }
int getMedian() { return values.empty() ? 0 : values[values.size() / 2]; }

Do I pass?

1

u/Slime0 Mar 02 '17

You passed the "slow solution very quickly" part.

1

u/rootbeer_racinette Mar 01 '17

So a heap question. What does this have to do with your job again?

8

u/quicknir Mar 01 '17

Yeah, because all it tests is your knowledge of heaps. It doesn't test big O, your problem solving ability, your intuition for CS, your ability to execute logic, your understanding of what an invariant is and how to formulate it, your ability to communicate it... oh wait it does. All of these things matter at my job, I don't know about yours.

2

u/rootbeer_racinette Mar 01 '17

No really, what do you actually do? What is it you are hiring for?

Surely you do more than take efficient medians all day long.

6

u/[deleted] Mar 01 '17

[removed] — view removed comment

3

u/KagakuNinja Mar 01 '17

Big O isn't irrelevant. But it rewards people who graduated from college recently, and people who cram for interviews.

If I need to know the big O of a algorithm, I can google it in seconds.

0

u/[deleted] Mar 01 '17

[deleted]

1

u/GhostBond Mar 02 '17

Ditto, Big O is practically irrelevant in web dev. Over a decade, I've never even had a use for it. On the other hand, understanding sql, tables, and being able to troubleshoot browser bugs are actual skills. Oh yeah, and doing a decent job of reporting errors.

1

u/[deleted] Mar 03 '17

[removed] — view removed comment

1

u/GhostBond Mar 03 '17

The reason is that that's where most of the work is. I didn't get into web dev because it's easier or superior, I got into it because that's where all the jobs seemed to be.

1

u/mikulas_florek Mar 01 '17

That does not mean that the position he interviewed people for did not require such knowledge. I create such algorithms almost daily.

1

u/HINDBRAIN Mar 01 '17

An array list? Am I missing something?

-2

u/AmalgamDragon Mar 01 '17

Being able to reject about a quarter of people with an interview I have put minimal time into preparing is already pretty good.

Not for the candidates or your company.

You seem like the kind of guy who would smugly reject a solution that used a doubly linked list with a mid-pointer that is maintained in sorted order via binary search insertions. Same O(lg n) to insert values, the same O(n) memory usage, and the same O(1) to get the median, but not the 'right' answer even though it let's you get the min, max, and percentiles in O(1) as well.

3

u/quicknir Mar 01 '17

You can keep dropping personal insults and snark throughout these posts, it doesn't make anything you say seem more correct.

I'm always happy to hear solutions I haven't thought of. Would like to hear for your solution how you plan to do binary search on a doubly linked list with a mid pointer.

1

u/AmalgamDragon Mar 01 '17

You can keep dropping personal insults and snark throughout these posts, it doesn't make anything you say seem more correct.

Nope, and that isn't the point of those comments any more than they were the point of your such comments. Rather the point is that your own such comments needed to be answered in kind.

I'm always happy to hear solutions I haven't thought of. Would like to hear for your solution how you plan to do binary search on a doubly linked list with a mid pointer.

There's a trick to it. Are you unable to figure out what it is?

2

u/quicknir Mar 01 '17

None of my comments insulted you personally in any kind of way.

No, I can't figure it out. Please tell me. How do you do it?

2

u/AmalgamDragon Mar 01 '17

None of my comments insulted you personally in any kind of way.

Incorrect. This was personally insulting: "I think what you are saying is clearly false on its face." ... "If you can come up with a good 6 hour problem in an hour or less, you're either a savant at this particular thing, or your problems are not good. There's just not really any other possibility."

It was personal (i.e. use of you, you're, your) and insulting (i.e. disrespectful).

This came after you insulted another poster with: "Lots of confidence. No data. How many randoms posting on reddit have more data, resources, or incentives to figure out better interviews than Google or Facebook? Right, none."

No, I can't figure it out. Please tell me. How do you do it?

Please take some more time to figure out. There's still plenty of time left in the hour!

2

u/quicknir Mar 01 '17

Well, clearly I don't control what you find insulting. I was saying that I thought that what you were saying is clearly false. Taking issue with what you said, not you as a person. Similarly with what I said about the 6 hour problem; I was being sincere. I know how long it takes most people to do this sort of thing, so if you can come up with a good problem in so little time you are either far above the norm, or maybe the problems you are coming up with are not good. Anyway, you can choose to be offended and lash out all you like.

As far as I know, it is impossible to do log(N) search on a sorted linked list with a single pointer into the middle, and therefore, I am not trying to figure it out. My guess is your solution will involve mutating the definition of a linked list so it's a skip list, or so that the nodes are contiguous. Or something else, not particularly clever nor interesting.

So please, if you have something interesting to say, say it in your next post, or else we can draw this conversation to a close.

2

u/AmalgamDragon Mar 01 '17

HR to you: We've decided not to pursue your candidacy further at this time.

Me to the team: [your name] doesn't have sufficient knowledge of data structures or strong enough problem solving skills. Couldn't figure out how to combine a linked list, a binary tree, and a few pointers for caching.

Well, clearly I don't control what you find insulting.

Just like it's the candidates that are problem, not the way you interview.

→ More replies (5)

2

u/mikulas_florek Mar 01 '17

Not for the candidates or your company.

Not for all of the candidates or your company.

We were small company. The more time I spend on interviews, the less time I spend programming which just was not an option. There were a lot of candidates and it just would not be possible to spend so much time with them. Yes, there might be the the "extremely good" candidate between those 25% who got rejected, but chances are in those 75% there is good enough candidate.

Everybody talks how companies are bad, but what about candidates. They do so much stupid, rude shit, wasting everybody's time. They are basically as bad as the companies. Thank god for all the filters. The very basic, extremely short test we used to send to junior candidates filters 50% of candidates. We never hear back from them. Then a company wonder, do they get the email? Or is it just too complicated for them? If company do not respond to candidate's email, they are angry. But candidates do the same shit.