Please help the novice to solve the problem in Java: there are stones, each stone has its own weight, I want to distribute the stones into 2 piles so that the difference in the heaps would be minimal. This task should be solved by enumerating all the options.
I want to solve this problem by exhaustive search. Created one array with "Stones" arr and the second bit of the same dimension a . The approximate algorithm is as follows: if in a[1]=0 , then arr[1] in the first heap, if a[1]=1 then in the second. And so go through all the options. But I can not write all this in Java