Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
more like dICK
Feb 15, 2010

This is inevitable.

Goonamatic posted:

Im currently interviewing.

Trying to do as many online tests as possible.

Found this one which Im having trouble with -- -- got the test but couldnt get the answer in the self certification test

http://codility.com/

Anyone else able to give this a go & see how they go?

Assuming you got the equilibrium index one, as that's the one that popped up for me.

Here's a brute force approach in Python. There's probably a better solution though:
code:
def equi ( A ):
    # write your code here

    for i in range(len(A)):
        lower = sum(A[:i])
        upper = sum(A[i+1:])
        if (upper == lower):
            return i
    return -1   

more like dICK fucked around with this message at 02:34 on Feb 9, 2011

Adbot
ADBOT LOVES YOU

more like dICK
Feb 15, 2010

This is inevitable.

_aaron posted:

I did that one like this:
code:
upper = sum(A)
lower = 0
for i in range(len(A)):
    upper -= A[i]
    if upper == lower:
        return i
    lower -= A[i]
return -1
Seems to break on large lists. This should give equilibrium at i=50000
code:
>>> for i in range(100001):
	x.append(1)

	
>>> def equi(A):
	upper = sum(A)
	lower = 0
	for i in range(len(A)):
		upper -= A[i]
		if upper == lower:
			return i
		lower -= A[i]
	return -1

>>> equi(x)
-1

more like dICK fucked around with this message at 05:17 on Feb 9, 2011

more like dICK
Feb 15, 2010

This is inevitable.
I really wouldn't use Windows unless I was actually writing Windows software.

more like dICK
Feb 15, 2010

This is inevitable.
Tries are legitimately my favourite data structure, because I love word games so much.

more like dICK
Feb 15, 2010

This is inevitable.

wide stance posted:

I'm surprised this hasn't been mentioned but there are plenty of emotional benefits of working for a startup:
Power, authority, excitement, sense of purpose and responsibility. All of those trump being a cog.

When the CEO consults with you personally before doing anything major.

Personally, I've worked for small, medium, and fortune 100 companies. I prefer medium as the perfect balance.

None of those trump going home at five and being paid real money.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply