← Questions

Fraud rules that can be added, replaced and removed

0
StripeCodingLast asked Sep 2026

Keep a live set of fraud rules, each with an ID, and check transactions against the rules active at that moment. A rule matches on one condition: the amount is at least a threshold, the country equals a value, or the merchant equals a value.

Process a sequence of operations in order: add or replace a rule by ID, delete a rule by ID (unknown IDs are ignored), and evaluate a transaction (amount, country, merchant). A transaction is flagged when any active rule matches. Return the verdict for every evaluation. Be ready to discuss how you would keep evaluation fast with many rules and how you would add new condition types.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding