This experiment surged from this tweet by @sindresorhus:
What's the simplest algorithm for splitting a (unordered) set of integers into n-2 even sub-sets where the sum of the elements in each sub-set have the minimum difference? Even better if someone has an example in Swift or JS. All the algorithms I found care about order.
— Sindre Sorhus (@sindresorhus) November 2, 2021
Basically, we want to put images into columns in such a way that the height of the columns is as similar as possible. As some people in the thread mentioned, this can be referred to as Greedy Number Partitioning, and several approximations exist.
In particular, I took three answers