Anyone heard of codility? (Automated Programming Assessment)
We had a discussion on testing programmers for interviews in here somewhere a couple days ago, and today I stumbled across codility.
What it seems to do is that it will ask you a programming problem, and the user will write a piece of code in their in browser editor then submit it. The system will then grade based on different test cases and optimizations of the code.
I took one to see what it was (you get 5 free tests). Lets you solve the problem in a bunch of languages. Pretty nifty.
Wondering what people in the industry think about it/if they've heard of it. Wish they offered more than 5 free tests as it's a nice little way to brush up on languages I haven't used in a while.
http://codility.com/
Neat idea, but good lord their editor is crap.
I took a python one, and was so close to getting it right, but ran out of time, so my score was 13 out of 100. Due to the lack of time, I couldn't really design things, so I wrote a mess that was hard to debug, and I only had 2 minutes to debug anyway, when I had written everything. Guh.
Here was my example text:
And my source text:
I made a couple of mistakes, like not realizing they might be passing in an empty list, or figuring out the correct answer, but it should be clear I know the language, and that I would have gotten the correct answer shortly. I'll probably look at my code some more after dinner and find out where I went wrong. Based on the debugging strings I took out right before I ran out of time, I was failing to assign to the post_totals.
At least I did okay on the whole "don't run out of time due to ridiculous recursion" by keeping it to three iterations. Oh, and ridiculously huge numbers as arguments didn't break anything, but that's because of python.
They handle debugging okay, they at least return the output to you when you verify, so that was nice.
Anyway, I think I deserve more than 13 out of 100, and I wouldn't recommend this for any kind of automated skill pegging by brainless HR people, although it is better than buzzword bing. Regardless, if someone were there with you (who also knows how to code) watching and maybe talking with you, then they would be able to peg your skill level pretty quickly.
Edit: Ugh, they have line numbers and they eviscerate indentation when you copy from the final results of the source. Oh, but they have a nice little source button on hover at the top that I didn't notice.
I took a python one, and was so close to getting it right, but ran out of time, so my score was 13 out of 100. Due to the lack of time, I couldn't really design things, so I wrote a mess that was hard to debug, and I only had 2 minutes to debug anyway, when I had written everything. Guh.
Here was my example text:
Quote:
Equilibrium index of a sequence is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in a sequence A:
A[0]=-7 A[1]=1 A[2]=5 A[3]=2 A[4]=-4 A[5]=3 A[6]=0
3 is an equilibrium index, because:
A[0]+A[1]+A[2]=A[4]+A[5]+A[6]
6 is also an equilibrium index, because:
A[0]+A[1]+A[2]+A[3]+A[4]+A[5]=0
(sum of zero elements is zero) 7 is not an equilibrium index, because it is not a valid index of sequence A.
If you still have doubts, this is a precise definition: the integer k is an equilibrium index of a sequence if and only if and .
Assume the sum of zero elements is equal zero. Write a function
int equi(int[] A);
that given a sequence, returns its equilibrium index (any) or -1 if no equilibrium indexes exist. Assume that the sequence may be very long.
And my source text:
def equi ( A ): equi_index = -1 B = list() # Construct the first two. B.append({'prev_total':0, 'post_total':0, 'total':A[0]}) B.append({'prev_total':A[0], 'post_total':0, 'total':A[0]+A[1]}) # Loop through A, sans the first 2 values. This run will be for previous and current totals. for i, v in enumerate(A[1:]): prev_total = B[i-1]['prev_total'] + B[i-2]['prev_total'] total = v + B[i-1]['total'] record = { 'prev_total': prev_total, 'post_total':None, 'total': total } B.append(record) # Now we can construct the last two for the post totals. B[-1]['post_total'] = 0 B[-2]['post_total'] = A[-1] # This run will set up the post totals for i, v in enumerate(reversed(B[:-2])): i = -3 - i # So we can efficiently access A in reversed order. A[-3] A[-4] etc. B['post_total'] = B[i+1]['post_total'] + B[i+2]['post_total'] # Now we can perform our testing for i, v in enumerate(B): if v['prev_total'] == v['post_total'] and i != 0 and i != len(B): return i elif v['total'] == 0 and i != 0 and i!=len(B): return i return equi_index
I made a couple of mistakes, like not realizing they might be passing in an empty list, or figuring out the correct answer, but it should be clear I know the language, and that I would have gotten the correct answer shortly. I'll probably look at my code some more after dinner and find out where I went wrong. Based on the debugging strings I took out right before I ran out of time, I was failing to assign to the post_totals.
At least I did okay on the whole "don't run out of time due to ridiculous recursion" by keeping it to three iterations. Oh, and ridiculously huge numbers as arguments didn't break anything, but that's because of python.
They handle debugging okay, they at least return the output to you when you verify, so that was nice.
Anyway, I think I deserve more than 13 out of 100, and I wouldn't recommend this for any kind of automated skill pegging by brainless HR people, although it is better than buzzword bing. Regardless, if someone were there with you (who also knows how to code) watching and maybe talking with you, then they would be able to peg your skill level pretty quickly.
Edit: Ugh, they have line numbers and they eviscerate indentation when you copy from the final results of the source. Oh, but they have a nice little source button on hover at the top that I didn't notice.
Quote: Original post by AndrewBC
Neat idea, but good lord their editor is crap.
As I've gotten used to writing code in notepad, so the editor was fine for me.
I think if they gave the whole report with the code you had finished for the person to look at it would be fine.
Quote: Original post by way2lazy2careQuote: Original post by AndrewBC
Neat idea, but good lord their editor is crap.
As I've gotten used to writing code in notepad, so the editor was fine for me.
I think if they gave the whole report with the code you had finished for the person to look at it would be fine.
Well I don't know about other modes, but in Python, the indentation sensing was really awful. It would regularly lose a space, so you go down to the next line, and you're one space behind the local indentation level, so I have to spend my time constantly repairing indentation because they can't get the editor right. Heck, it even would have been better just being a dumb editor, because then I can tab myself.
Tried it out, also got the equilibrium index one (I wonder if that's their only sample). Not very difficult -- 100 out of 100 in about five minutes and ten lines of code -- but this is exactly the sort of first-pass filter that's useful for companies looking for programmers. Of course, any decent programmer should be able to come up with code tests, but this does save them the trouble, and allows them to grade code outside their language areas. Potentially very useful for employers.
Quote: Original post by Sneftel
Tried it out, also got the equilibrium index one (I wonder if that's their only sample). Not very difficult -- 100 out of 100 in about five minutes and ten lines of code -- but this is exactly the sort of first-pass filter that's useful for companies looking for programmers. Of course, any decent programmer should be able to come up with code tests, but this does save them the trouble, and allows them to grade code outside their language areas. Potentially very useful for employers.
HM, now I feel like I'm missing out on something. How were you able to figure it up so quickly? Do you have any hints for ignoramus I?
Quote: Original post by AndrewBC
HM, now I feel like I'm missing out on something. How were you able to figure it up so quickly? Do you have any hints for ignoramus I?
I was just about to PM you, but since you asked:
def equi(A): totals = list() accum = 0 for element in A: totals.append(accum) accum += element for idx in range(0, len(A)): if totals[idx] == accum - totals[idx] - A[idx]: return idx return -1
I don't think there's any secret to it, just that it takes lots of practice to develop the ability to rapidly condense a problem down to the simplest solution.
Well, here's my solution. (Incidentally, I think it is totally awesome that everyone's using Python.) a holds the sum before the pivot; b holds the sum after the pivot.
EDIT: I think I actually prefer crusadingknight's approach, since it doesn't involve any special-casing for the last iteration.
def equi ( A ): b = sum(A[1:]) a = 0 for i in range(len(A)): if a == b: return i a += A if i<len(A)-1: b -= A[i+1] return -1
EDIT: I think I actually prefer crusadingknight's approach, since it doesn't involve any special-casing for the last iteration.
Quote: Original post by crusadingknight
*** Source Snippet of Awesome ***
Quote: Original post by Sneftel
*** Source Snippet of Awesome ***
Ah! I see where I went wrong now. I misunderstood the premise just a bit. D'oh. Going about it bass ackwards didn't help, either. Thanks for helping me grok the (in)obvious simplicity I was missing.
I had a go with the C# version, which just made me realise how much I love Visual Studio. The editor kept cocking up the indentation, and the line numbers reported by the compiler when I made a minor syntax cock-up didn't match the line numbers in the editor.
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement