The idea for Coupon Calculator came about in a completely everyday
situation - while shopping online. I noticed that shopping apps, in my case SHEIN, automatically
suggest the most cost-effective coupon for the entire basket, but do not fully utilise the potential
of available discounts. It is often more advantageous to split the list of products into several
smaller orders and use more coupons. This idea became the starting point for creating an application
that automatically calculates the best combinations of products and coupons, allowing you to save
even more. The first version was created out of curiosity and a desire to see if it could be done
purely algorithmically. Initially, everything worked flawlessly - until we had to deal with a larger
data set, which revealed that the seemingly simple calculator turned out to be a small
computational monster in practice.
Every possible combination of products and coupons meant that a huge
number of combinations had to be generated - exactly 2^n subsets of products, each of which
had to be multiplied by the number of available coupons. This meant that with a list of 16 products
sent by my girlfriend, the number of combinations exceeded the capabilities of modern computers. It
was then that I realised that the problem was not in my code (at least not only), but in the very
nature of the task. And so began the second iteration of the project, whose main goal was to optimise
performance. The solution turned out to be the use of heuristic algorithms, which,
instead of searching for the absolute best solution, allow you to find a solution that is ‘good
enough’ but achievable in a reasonable amount of time. In short - large data sets are divided into
smaller batches, the size of which is controlled by configuration variables, making it possible to
maintain a balance between accuracy and performance.
Today, Coupon Calculator is not only an example of successful
optimisation, but also proof of how a practical problem can become the starting point for anambitious
engineering project. The application shows how the art of compromise between precision and
performance can translate into practical benefits — in this case, saving the user money and time. It
is also a story about how curiosity, observation and the desire to solve an everyday
problem can turn into a project with a solid engineering background and potential for further
development. Coupon Calculator has thus become not only a technical exercise, but also a story
about the pursuit of efficiency, learning through experimentation, and combining theoretical
knowledge with practical application in the everyday world.