4 ms·
A previous job was working at a supermarket's online store. Supermarket's have all sorts of weird specials eg "4 pies for $5" or "a pie and a coke for $3". We
by slyall 3y ago
A previous job was working at a supermarket's online store. Supermarket's have all sorts of weird specials eg "4 pies for $5" or "a pie and a coke for $3".
We were running into problems when we had large test baskets ( $500 always, $200 sometimes ) that there would be so many combinations of specials that calculating the best way to apply them was causing CPU load and timeouts.
Fix was somebody sat down, remembered their CS classes and applied a more scalable algorithm. Problem fixed.