Get the latest tech news
Algorithmic fitting of Japanese candy
Introduction to bin packing through a simple example of fitting boxes of candy inside a parcel.
npermutations16286432488324107495424At a million tests per second, 4 boxes would already take over a minute in the worst case, although you can abort as soon as you find a fit. It would make sense to try some common arrangements first, and to not venture down recursive branches where the previous box combination is already known not to fit. I am likely to use an existing solution if I adopt this way to find optimal candy sequences, since at this point my JavaScript code is just too slow.
Or read this on Hacker News