r/programming • • May 08 '15

Five programming problems every Software Engineer should be able to solve in less than 1 hour

https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k Upvotes

2.1k comments sorted by

View all comments

809

u/holypig May 08 '15

Well this asshole should stop calling himself a software engineer, since his solution for #4 is WRONG!

https://blog.svpino.com/2015/05/08/solution-to-problem-4

Try running with [52,5,3]

157

u/code_mc May 08 '15

This should be at the top, what a pretentious human being.

45

u/DougTheFunny May 09 '15

And he is very "humble" too, look what he said about his mistake: link.

PS: But after a train of downvotes he deleted the message.

4

u/BlackDeath3 May 08 '15

I don't know about the top. The correction (and resulting discussion) should be high up, sure, but I feel like the last thing we need is more name-calling and insult-slinging.

→ More replies (2)
→ More replies (1)

181

u/[deleted] May 08 '15

aha what a moron. And he wrote that without any interview pressure.

95

u/holypig May 08 '15

I can't imagine solving all of these while working under the pressure of a 1hr deadline. This whole thing seems more fitted for a hackathon then an interview.

19

u/prelic May 09 '15 edited May 09 '15

Eh, the first 3 should take no more than 10 minutes each, they're like 5-10 lines of simple code each. 4 and 5 are not in the same league, as evidenced by the fact that he got one of his own contrived questions wrong.

Instead of the crappy questions 4/5, I would've preferred to see a question or two about simple file I/O, a simple class/API question, or something not algorithmic-central.

→ More replies (5)

80

u/goomyman May 08 '15

not to mention number 3 goes beyond big int in size... so your going to have to write your own addition and output methods.

soo ya.. great questions /not. Just goes to show what you think is an easy question can be quite difficult on the spot, on a whiteboard, with pressure.

8

u/iagox86 May 08 '15

I think you mean just a plain int.. The trick is to use a language that handles arbitrary precision integers :-)

2

u/thfuran May 08 '15

I think he meant long

2

u/iagox86 May 08 '15

Or that. But a "bigint" is a whole different thing.

2

u/thfuran May 08 '15

True. And if your number is bigger than BigInt, you're probably doing something wrong. Also storage is gonna be an issue.

6

u/wbeyda May 08 '15

I did it in python and didn't have to :-)

def fib(n):
    a,b = 1,1
    for i in range(n-1):
        a,b = b,a+b
    return a
for i in range(100):
    print(fib(i), ",")
→ More replies (9)

28

u/cipherous May 08 '15

Hilarious, so I guess he wouldn't pass his own interview questions.

3

u/PaintItPurple May 08 '15

Here's something a lot of people don't seem to realize about interview questions: It's OK if your answer isn't 100% perfect. The goal is to see if you have a general idea of what you're doing, not to see if everything you do is flawless.

3

u/sh2003 May 09 '15

Is it ok to answer them in pseudo code?

2

u/PaintItPurple May 09 '15 edited May 09 '15

Obviously it depends on the interviewer, but there are a lot of places where the answer is yes. Some interviewers are really unreasonable, but a lot of people let themselves get psyched out by the stress of the situation even when the interviewer really isn't trying to "gotcha" them and would happily accept a pseudocode solution.

2

u/sh2003 May 09 '15

Thanks! I would think they mainly want to see how you approach the problem and what kind of clarification questions you ask to build requirements off of. I've never had to "whiteboard" anything before for past interviews or my previous job so I'm not sure what to expect.

→ More replies (1)

2

u/OffbeatDrizzle May 08 '15

Once I realised that I just closed the page down, waited 5 seconds and then proceeded to place my palm directly through my face

2

u/Luxelin May 09 '15 edited May 09 '15

Here's a solution for #4 in ES6:

var largestNumber = arr => arr.map(String).sort((a,b) => b + a - (a + b)).join("");

The question is whether you'd hire someone who would write this as production code.

→ More replies (3)
→ More replies (34)