I have an array with numbers in it and want to loop through all combinations of them to calculate a minimum difference between the selected numbers and the rest.
How would such a loop look like? I’ve tried to find a solution, but somehow it doesn’t seem to be easy to find such a algorithm.
I have an array with numbers in it and want to loop through all
Share
To solve your actual problem, i.e.
or in other words
or in other words
Now, you can do a quick search as there are various solutions there.