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
_aaron
Jul 24, 2007
The underscore is silent.

DIW posted:

Here's a brute force approach in Python.
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

Adbot
ADBOT LOVES YOU

_aaron
Jul 24, 2007
The underscore is silent.

DIW posted:

Seems to break on large lists. This should give equilibrium at i=50000
That's because there was a typo! lower -= A[i] should have been lower += A[i]
code:
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
I just tested with the same list you used, and it seems to work fine if I use the correct code ;)

_aaron
Jul 24, 2007
The underscore is silent.

Otto Skorzeny posted:

... in which case any raise they give you is really an advance against future raises - they're going to pull the same shenanigans again.
This isn't really true. Lots of companies (especially bigger ones) give out raises as a percentage each year. If you get a bigger raise one year, that factors into all future years. (e.g., If you would typically get a 5% raise each year, and this year you get a 10% raise due to a counter-offer, all of you future 5% raises are actually bigger than they would have been.)

_aaron
Jul 24, 2007
The underscore is silent.

MachinTrucChose posted:

I'm a fresh grad. I had an interview today, where everything went really well, but...

It's definitely raising the sorts of flags you guys warn about, but it will help my career more than staying at home would.
Where did you live, and how's the job market there? If you want to program, that's definitely a position I'd avoid. However, if there's nothing else available, you're probably right in that it's a better career move than staying at home or doing something completely unrelated to programming.

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