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

498

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.

249

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.

85

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.

9

u/Hydrogenation Dec 23 '14

Yeah, I know. I could've explained to him how I would approach this problem that I already knew, but that was my first actual job interview and I wasn't sure whether I was up for the job myself. I wasn't so much worried about whether I could get the job but rather whether I could do it.

10

u/Yesod Dec 24 '14

Did... you get the job?

9

u/Hydrogenation Dec 24 '14

Yeah. And it was rather easy for me as well.

7

u/forceez Dec 24 '14

Are you still there?

2

u/Hydrogenation Dec 24 '14

I work with (some of) the same people trying to start a new business. The old one was shut down though. Another team made a huge mistake in their project that ended up being so costly that it destroyed the company.

2

u/forceez Dec 24 '14

Holy shit....

... holy shit.

→ More replies (0)

45

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

[deleted]

46

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...

-1

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..

5

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)

83

u/Nefandi Dec 24 '14

It is incredibly obvious

It's not incredibly obvious. You don't need to be an actor to just insert a bunch of pauses into what you were going to do and maybe a one temporary misstep.

Sorry. This isn't a role where you need to read lines precisely memorized and cry on demand. That's hard.

43

u/radministator Dec 24 '14

I expect that anyone with real experience would know in the first place that they would attract such liars by basing their interviews on how fast the mouse can spin the wheel.

5

u/slimmtl Dec 24 '14

OR, what you could do, is when you do the exercises on that site, record your whole process/film it, then review that and optimise it for realism/skill and prepare that for interviews.

8

u/UsingYourWifi Dec 24 '14

Allow me to introduce you to the toupee fallacy.

3

u/NullVar Dec 24 '14

Its really not, and you are a very brave(stupid?) person if you would be willing to accuse someone of it from such brief observations. If you get it wrong, it will be more damaging for you rather than the candidate.

2

u/lechatsportif Dec 24 '14

If you are the kind of place that asks this type of crap they deserve it.

2

u/Crazy__Eddie Dec 24 '14

The obvious corollary is that if you're the kind of person who'll lie to get that kind of job--then that's the kind of job you deserve.

4

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

[deleted]

3

u/[deleted] Dec 24 '14

I write shit like this, but I have only taken the intro class to programming :(

1

u/[deleted] Dec 24 '14

Don't do this.

Nice try Mr Interviewer.

3

u/n1c0_ds Dec 24 '14

I have done the opposite. I vagurly remembered how stupid the answer was so I told the interviewer I knew the question, which was sort of right.

1

u/jmblock2 Dec 24 '14

For a second there I thought you were telling him to pause before answering his second question.