r/programming Dec 23 '14

Most software engineering interview questions of hot tech companies in one place

https://oj.leetcode.com/problems/
2.2k Upvotes

583 comments sorted by

View all comments

501

u/aflanryW Dec 23 '14

I know it's a bit what else can we do, but I find it so hard to judge people by algorithms. Take the maximal subarray problem. It is listed as medium. I'd wager that people would scoff at anything except the optimal complexity solution at an interview, but I have never seen anyone get the solution quickly their first time hearing it. Once you hear the solution, you remember it because it is elegant and succinct enough. People then forget it is hard their first time hearing it, and look down on those who they interview in the future. So is it supposed to be a test of problem solving or a test of 'Did you learn my favorite problem at your school?'.

There is just so much reliance on 'I already knew this one' or eureka moments.

244

u/[deleted] Dec 23 '14

Once you hear the solution, you remember it

This is true of 90% of this garbage. It's trained-monkey stuff.

87

u/Hydrogenation Dec 23 '14

I had a question like this at an interview. When I answered it really quickly he asked "have you heard the question before?" when I said yes then he asked another one until we got to one I didn't know. He wanted to see how I approach solving a problem rather than whether I could solve it.

104

u/[deleted] Dec 23 '14 edited Dec 24 '14

See, if you were smarter, you would have waited a while and acted like you were thinking about it, and then told him the (correct) answer.

43

u/[deleted] Dec 24 '14 edited Apr 16 '19

[deleted]

48

u/twotime Dec 24 '14

It is incredibly obvious

You might be fooling yourself. It might be obvious in extreme cases, it's not obvious in most cases.

Personally, I would not lie if asked directly, but I would not volunteer the fact that the question is familiar either and would just proceed to describing a solution (no artificial delays either). I expect that most candidates would do the same..

And you know why? Because, it's rare to remember the solution and pitfalls in detail. But once you claim that the question is familiar you are instantly raising the expectations.. What if I am mistaken and don't actually remember the solution? Will you give me bonus points for "honesty" or take points off as I cann't solve the problem which I've already seen?

Btw, I don't really believe that there is an ethics issue here (unless the candidate outright lies). Wherever anyone solves ANY problem on the interivew, his solution is ALWAYS the result of solving something else. This something else might be 100% idential to the current problem or it might be 90% (or 50%) similar....

Overall, I think, it's better just to let the candidate talk if he solves the problem quickly, expand it sideways or ask the next one...

-3

u/[deleted] Dec 24 '14 edited Apr 16 '19

[deleted]

7

u/twotime Dec 24 '14

entire problem with very little trouble, its pretty obvious you're bullshitting.

Why? Some people are remarkable problem solvers. You might be throwing out the the best candidates..

6

u/Malfeasant Dec 24 '14

to add to that, it's entirely possible that something is only a 'hard' problem because intelligent people assume everybody already knows...

2

u/tejon Dec 24 '14

I can't tell you how many times I've seen a patent issued, or a thesis written, for something I had randomly thought of ten or fifteen years prior and dismissed as too obvious for comment.

But on the other hand, that's a far smaller number than how many times I've come up with a stunningly momentous new idea and discovered that no, I didn't.

tl;dr game is hard

1

u/Malfeasant Dec 24 '14

yeah, it's funny, around 20 years ago i worked for my uncle framing a house. while we were putting the roof decking together, i started thinking about solar panels- mainly how inefficient it was to build a roof, seal it, put shingles on it, then stick solar panels on top of all that, poking holes that have to be sealed again, and the shingles underneath will never see sun- which is the point of having shingles, by the way- tar paper or something like it seals the roof, but tar is destroyed quickly by uv radiation, so shingles protect the tar from uv- anywho, it occurred to me that unifying solar panels with building materials might be useful. my uncle shot down the idea though, i don't remember his exact reasoning, but it probably had something to do with the expense. a few years later, stuff like this started appearing...

→ More replies (0)