Hello, i encounter a problem about Subsetting an array
"Given an array of Integers in which you have to subset it into 2 sub, subA and SubB where sum of SubA > sum of SubB and count of SubA < count of SubB. return the SubB"

input  : [6,5,3,2,4,1,2]
output : [4, 5, 6]
explanation :
subA =  4 + 5 + 6  =  15
the count is 3
and 
subB = [3,2,2,1] = 8
count is 4

if it's a function, this is how the interface looks like

func subSet(arr:[Integers]) -> [Integers]

my current solution cost n^3 (including sum the Integers) in time. Are there any other solution far better than mine?

Comments (4)