Facebook | Phone screen | Split array equal sum
6922
Apr 26, 2019
Jul 07, 2019
Position: Production Engineer
You're given an array made up of positive integers. Split the given array into two smaller arrays where the sums of each smaller array are equal. Print out the two smaller arrays.
eg.
[1,2,1,1,3] -> [1,2,1] & [1,3]
[1,1,1,1,1,5] -> [1,1,1,1,1] & [5]
[5,2,3] -> [5] & [2,3]
-> had to ask for clarification: print any arbitary error message if the given array isn't splitable.
Comments (12)


