Comparing Brute Force and Greedy algorithms to find the optimal credit card assignment for maximum cashback
A project comparing Brute Force and Greedy algorithms to find the optimal credit card assignment for maximum cashback. Given multiple credit cards with different cashback rates per spending category and individual spending limits, the system determines which card to use for each category to maximize total cashback.
The core logic was originally implemented in Java as an algorithms course project, then re-implemented as an interactive web demo where users can input their own cards, categories, and rates and see both algorithms run side-by-side in real time.
Set how many credit cards you have and the maximum you can spend on each one.
Enter what you spend in each category (e.g. groceries, gas) and each card's cashback percentage for that category.
Click "Run Algorithms" and both methods will figure out which card to use for each category to get you the most cashback.
See the results side by side and check whether both methods agree or one found a better answer.
Both Brute Force and Greedy found the same total cashback. This means the Greedy shortcut happened to find the best possible answer.
Brute Force found a higher cashback than Greedy (or vice versa in rare edge cases). This shows that taking the "obvious best" choice at each step does not always lead to the best overall result.
The total spending across all categories exceeds what the cards can handle. No combination of card assignments can stay within every card's limit.
Time Complexity: O(nm)
Time Complexity: O(n × m)