Advertisement

Codility - Is it reasonable?

Started by September 17, 2010 01:33 PM
54 comments, last by way2lazy2care 12 years, 9 months ago
Quote: Original post by Alpha_ProgDes
(like Codility seems to be)?

Codility doesn't reject anyone. They only deal with hosting and service. Evaluation of results is left to employer.

At which point you're back to square one - if someone rejects candidates who aren't 100%, then they would do the same in other forms of interviews as well - it would just waste much more time for both.
Quote: Original post by Washu
Why? Its an interview question. You should do the absolute BEST you can on it. Show your skills. He didn't, he failed.

being able to fix problems is just as important a skill as writing good code. What happens when the guy that writes good code but can't solve problems runs into a problem? Does he sit there for a week twiddling his thumbs?

I know the first time I did the codility practice test I missed the overflow thing because it just never occurred to me that that might come up. Given all of 30 seconds after getting the test results I would have solved it.

A small note like "There may be arrays of thousands or millions of numbers" would easily solve the problem.

@OP: you're lucky you didn't get the "name the 15 best types of pie in order of my preference" test or the "I just don't like you" test.

The answer to the first is pecan, pecan, pecan, pecan, pecan, pecan apple hybrid pie, crumb top apple pie, key lime, and chicken pot. the last 5 are a trap.
Advertisement
Quote: Original post by way2lazy2care
I know the first time I did the codility practice test I missed the overflow thing because it just never occurred to me that that might come up. Given all of 30 seconds after getting the test results I would have solved it.

A small note like "There may be arrays of thousands or millions of numbers" would easily solve the problem.

I don't know how you missed this, since it's been mentioned multiple times in the thread so far, but the codility practice test contains the line "Assume that the sequence may be very long."
I administer tests similar to this in-office right now. I kind of liked the example test on Codility, so I might consider replacing my in-office tests with Codility tests.

Quite frankly (and with no personal offense intended to anyone), I don't want to hire a programmer who can't make it through that particular problem in 30 minutes. If they fail on a very long list timeout, that's another question, but if it genuinely takes more than 30 minutes to work through it, they'll never keep up in our office.

I took about 5 minutes to write a correct O(n) answer in &#106avascript, 0.7 second execution on their long-list test:
function equi ( A ) {    var sumAfter = 0;    for(var i = 0; i < A.length; i++)        sumAfter += A;        var sumBefore = 0;    for(var ret = 0; ret < A.length; ret++) {        sumAfter -= A[ret];                if(sumAfter == sumBefore)            return ret;                sumBefore += A[ret];    }        return -1;}
Curious, I took the example test.

In about 25 minutes I had an O^2 solution. 56/100

Spent about 20 minutes thinking about it and researching on the internet.

In about 10 minutes I had a pretty simple solution (which I am proud to say I came up with using my own algorithm). 94/100

Still missed the overflow question, ben, how are you supposed to handle arithmetic overflow? I used long ints but it was not enough.

I would feel bummed if I didn't get a chance because of this test, but at the same time, it confirms that you'll get a much better result of candidates. I spend more of my time actually coding features in my games then working on algorithms or optimization.


My solution to the problem was to sum the entire array in the first iteration and set it to the high side sum, low side was set to 0. I iterated through the array again, adding i-1 to the low side and subtracting i from the high side.
Quote: Original post by ChurchSkiz
Still missed the overflow question, ben, how are you supposed to handle arithmetic overflow? I used long ints but it was not enough.

...

My solution to the problem was to sum the entire array in the first iteration and set it to the high side sum, low side was set to 0. I iterated through the array again, adding i-1 to the low side and subtracting i from the high side.

According to the spec, &#106avascript uses double-precision floats for all numbers. In real-world terms, that means basically no overflow, almost ever.<br><br>My solution was the same as what you describe.
Advertisement
Quote: Original post by no such user
I don't know how you missed this, since it's been mentioned multiple times in the thread so far, but the codility practice test contains the line "Assume that the sequence may be very long."


i dunno, I took it the first time multiple months ago and I didn't remember exactly what peeved me. looking back it looks like it's significantly more difficult in C++ than in python, and that might have been what upset me.
Imagine that: a low level programming language with a million corner cases actually makes things more difficult than a high level language. You know, there's a reason that people claim that other languages are more productive than C++.
Quote: Original post by no such user
Imagine that: a low level programming language with a million corner cases actually makes things more difficult than a high level language. You know, there's a reason that people claim that other languages are more productive than C++.

what relevance does that have to testing a person's programming ability?
You chose to use a harder programming language, and then you bitch because the problem is harder with the harder programming language. That's just silly. The difference between C++ and higher level languages is more than just manual memory management. If you can't realize that then it does reflect negatively on your programming ability.

This topic is closed to new replies.

Advertisement