izard: (Default)
izard ([personal profile] izard) wrote2010-02-28 04:54 pm

Simple coding.

After reading this: http://www.codinghorror.com/blog/2010/02/the-nonprogramming-programmer.html
I've got a bit scared: last year I do little coding, and when I do it's 90% of the time making other ppl's code more efficient/scalable, rather then developing my own. Or even Powerpoint coding, shame on me.

I've never been a fan of topcoder etc, because I am pretty slow thinker. But I was a bit scared that may be by now my brain is already dead, and I've became a non-programming programmer.

Went to http://codility.com/ (mentioned in the comments to the post above), and checked. Last time I've used Java was 3 years ago, but it took me 6 minutes to do the first simple task that passed all tests but BigInteger test (I knew in advance but was lazy) So I hope I am not hopeless, but still I would not pass interview [livejournal.com profile] ivan_ghandhi style.

int equi ( int[] A ) {
int len = A.length;
int sum1 = 0; int sum2 = 0; int i;

for (i = 0; i < len; i++) sum2 += A[i];

for (i = 0; i < len; i++) {
sum2 -= A[i];
if (sum1 == sum2)
return i;
sum1 += A[i];
}

return -1;
}

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting