troubleshooting Question

canBalance challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
JavaJava EEProgramming Languages-OtherProgrammingSystem Programming
34 Comments2 Solutions812 ViewsLast Modified:
Hi,

I am working on below challenge

http://codingbat.com/prob/p158767

I have not understood the description properly

Given a non-empty array, return true if there is a place to split the array so that the sum of the numbers on one side is equal to the sum of the numbers on the other side.

canBalance([1, 1, 1, 2, 1]) → true//i thought since 1+1 is not equal to 2+1 it should be false?
canBalance([2, 1, 1, 2, 1]) → false//i thought since 2+1 is equal to 2+1 it should be true??
canBalance([10, 10]) → true


please advise
ASKER CERTIFIED SOLUTION
rrz
student

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 34 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 34 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros