1D knapsack with size of set stored

Divide array two halves difference minimum and size difference maximum 1.