Over a million developers have joined DZone.

Thursday Code Puzzler: Balancing Arrays

DZone 's Guide to

Thursday Code Puzzler: Balancing Arrays

· Java Zone ·
Free Resource

It's Thursday already, so time for another code puzzler. The idea is simple: solve the coding problem as efficiently as you can, in any language or framework that you find suitable.

Note: Even though there really is nothing stopping you from finding a solution to this on the internet, try to keep honest, and come up with your own answer.  It's all about the participation!

Balancing Arrays 

Given an array of numbers,  return the index at which the array can be balanced by all numbers on the left side add up the the sum of all numbers of the right side. For example, an array with 

[1,5,6,7,9,10] can be balanced by splitting the array at position 4.   

Catch up on all our previous puzzlers here


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}