News for hackers. Stuff that matters.
Re:Python coding interview challenges by nickpeterson on Monday April 03, 2017 @09:05AM (#14022428)
"Before we hire you, we first need you to outwit this burmese python..."
Re:Python coding interview challenges by bogomipz on Monday April 03, 2017 @09:52AM (#14022725)
Indeed. A couple of weeks ago I had a recruiter from Atlassian send me an email saying they were interested an could I complete these 6 problems on Hacker Rank and each challenge has a time limit.

Its not enough to outwit a Burmese Python but you need to do it while a clock is ticking.

We all know the best performance and indicator of skill always comes from coding with an egg timer or stop watch.

Oh and did I mention the Hacker Rank challenge was being asked before even speaking to a human being about the job?

Re:Python coding interview challenges by jacquesm on Monday April 03, 2017 @09:57AM (#14022754)
These companies carrying water for Hacker Rank and their ilk ought to be totally ignored.

Programming is only a competition sport when it is voluntary, no need to turn access to a job into some kind of Christians versus the lions spectator sport.

If someone were to approach me with that kind of offer I think the response would not be much longer than one line (and I'd try hard to keep it polite).

Re:Python coding interview challenges by bogomipz on Monday April 03, 2017 @10:08AM (#14022833)
>"These companies carrying water for Hacker Rank and their ilk ought to be totally ignored."

Yeah, I just deleted the email.

In the case of Atlassian and some others I have seen recently, the job of the recruiter now seems to be sending out links to hacker rank challenges after a successful key word search on a candidates C.V. I imagine recruiters love this because it means they now have to understand even less than the little they understood before.

Re:Python coding interview challenges by user5994461 on Monday April 03, 2017 @10:29AM (#14022996)
> Oh and did I mention the Hacker Rank challenge was being asked before even speaking to a human being about the job?

I prefer that a lot more than scheduling a 1 hour phone interview during my workday, to do the same stupid questions over the phone, with someone who can describe neither the job nor the company.

Re:Python coding interview challenges by bogomipz on Monday April 03, 2017 @10:37AM (#14023039)
Sure, that scenario is equally broken and happened to me with a big S.V company recently. If the company can't even schedule an interview with someone on the actual team then I'm probably not interested in the company and can and have cut the phone interview short upon learning that.
Re:Python coding interview challenges by user5994461 on Monday April 03, 2017 @12:42PM (#14024366)
It's not enough to be on the team, the person has to be able to talk, not a mute engineer.
Re:Python coding interview challenges by bogomipz on Monday April 03, 2017 @01:15PM (#14024813)
I completely agree.
Re:Python coding interview challenges by fwefwwfe on Monday April 03, 2017 @04:58PM (#14027081)
It's even better when you or a recruiter has sent them your resume and it's obvious that they've ignored it and are looking at your outdated LinkedIn profile.
Re:Python coding interview challenges by riebschlager on Monday April 03, 2017 @09:11AM (#14022454)
I'd rather take my chances with a snake than trying to solve "Add two integers without using + or -".
Re:Python coding interview challenges by recursive on Monday April 03, 2017 @12:04PM (#14023908)
I couldn't resist.

    add = lambda a, b: add(a ^ b, (a & b) << 1) if b else a
Re:Python coding interview challenges by recursive on Monday April 03, 2017 @03:22PM (#14026175)
And if you need to handle negatives:

    def add(a, b):
        while a and b:
            if a ^ b < 0: (a, b) = (a & ~b, b & ~a)
            (a, b) = (a ^ b, (a & b) << 1)
        return a or b
Re:Python coding interview challenges by Humdeee on Monday April 03, 2017 @04:30PM (#14026847)
Excel to the rescue.
Re:Python coding interview challenges by brianwawok on Monday April 03, 2017 @09:33AM (#14022604)
sum([5,6]) ?
Re:Python coding interview challenges by emidln on Monday April 03, 2017 @09:54AM (#14022738)

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 2, in one_true_addition_test_case
    AssertionError
The "correct" answer according to my pet parrot is (5).__add__(6). Of course, as per real-life, "correct" is usually just an aspect of if you find the interviewer's solution instead of whether your solution is actually correct. Better luck next time!
Re:Python coding interview challenges by tedmiston on Monday April 03, 2017 @09:54AM (#14022739)
The sum built-in is still using the addition operator with syntactic sugar though (as is the other child comment). I think the intent of this question is to solve it with bitwise operators ie, [1].

[1]: http://stackoverflow.com/questions/17342042/why-this-code-fo...

Re:Python coding interview challenges by jacquesm on Monday April 03, 2017 @09:59AM (#14022772)
If you're going to have to argue about the 'intent of the question' then you've already lost.

Really, the question should be 'add these two integers' and any solution that produces the result in a transparent and straightforward way should be honored with top marks.

Trick questions, especially those where only the interviewers pet solution is permitted are a sure sign that this employer is best avoided because they care about form and ego more than they care about getting the bloody job done.

Re:Python coding interview challenges by soVeryTired on Monday April 03, 2017 @10:17AM (#14022896)
log(exp(5)*exp(6))?

Guess that won't work too well with larger numbers...

Re:Python coding interview challenges by dr_zoidberg on Monday April 03, 2017 @11:17AM (#14023374)
It breaks quite early:

    In [8]: math.log(math.exp(5000) * math.exp(6000))
    ---------------------------------------------------------------------------
    OverflowError                             Traceback (most recent call last)
    <ipython-input-8-3d6e46c58c45> in <module>()
    ----> 1 math.log(math.exp(5000) * math.exp(6000))

    OverflowError: math range error

    In [9]: math.log(math.exp(500) * math.exp(600))
    Out[9]: inf
Re:Python coding interview challenges by brianwawok on Monday April 03, 2017 @11:35AM (#14023547)
Hey let's not be a quitter

    >>> (Decimal(5000).exp() * Decimal(6000).exp()).ln()
    Decimal('11000.00000000000000000000000')
Re:Python coding interview challenges by dr_zoidberg on Monday April 03, 2017 @12:06PM (#14023936)
Nice catch, but then:

    In [13]: Decimal(5000000).exp() * Decimal(5000000).exp()
    ---------------------------------------------------------------------------
    Overflow                                  Traceback (most recent call last)
    <ipython-input-13-8333724ae893> in <module>()
    ----> 1 Decimal(5000000).exp() * Decimal(5000000).exp()

    Overflow: [<class 'decimal.Overflow'>]
The problem is that the multiplication blows the precision of the used format (either double for math.log(...) or the one the decimal module uses).

I had also thought about the intention of the question trying to get you to express the sum as bit operations (thought I admit that sounds like going for a very low-level profile), or maybe just "thinking outside the box".

Re:Python coding interview challenges by brianwawok on Monday April 03, 2017 @12:21PM (#14024120)
Hey don't be a quitter, we can make Decimal support way bigger numbers via context
Re:Python coding interview challenges by dr_zoidberg on Monday April 03, 2017 @02:09PM (#14025416)
Alternative, buzzwordy approach: let's train a convolutional neural network to do addition!
Re:Python coding interview challenges by brianwawok on Monday April 03, 2017 @05:07PM (#14027149)
Can it run the MEAN stack?
Re:Python coding interview challenges by dr_zoidberg on Tuesday April 04, 2017 @02:25PM (#14035778)
Yes, and we'll deploy it on The Cloud.
Re:Python coding interview challenges by mythrwy on Monday April 03, 2017 @04:44PM (#14026967)
len([i for s in ([i for i in range(x)], [i for i in range(y)]) for i in s])
Re:Python coding interview challenges by mythrwy on Monday April 03, 2017 @06:47PM (#14027953)
(as long as it doesn't need to be fast or do negative numbers)
Re:Python coding interview challenges by kernelbandwidth on Wednesday April 05, 2017 @01:48PM (#14043987)
In Academia, it's not necessarily a Burmese Python. If you write a better dissertation, you'll get a smaller snake to face off with.

https://www.mcsweeneys.net/articles/faq-the-snake-fight-port...

Re:Python coding interview challenges by JamesMcMinn on Monday April 03, 2017 @09:10AM (#14022445)
Honestly, I think you'd learn more about a potential hire that way than by presenting them with these sort of challenges.
Re:Python coding interview challenges by nickpeterson on Monday April 03, 2017 @09:13AM (#14022474)
"We see you're familiar with compression but how about pandas?"
Re:Python coding interview challenges by dr_zoidberg on Monday April 03, 2017 @10:46AM (#14023095)
I fear the part of the interview that gets into spiders for web scraping...