1p3a Question · Apr 2026

Amazon SDE-2 LLD Round Rule Engine Design

SWE System Design Easy

Question Details

Problem statement given Design a simple rule engine that: 1.Takes a list of credit card expenses 2.Applies a set of rules 3.Flags the expenses that needs review 4.More rules can be added in future

Full Details

Problem statement given Design a simple rule engine that: 1.Takes a list of credit card expenses 2.Applies a set of rules 3.Flags the expenses that needs review 4.More rules can be added in future. 5.Design needs to be maintainable.

Example Rules Restaurant expenses should not exceed 70 dollar. Airfare expenses should not be allowed. Any expense above 250 dollar should be flagged.

My Approach (Simple Version) I modeled each rule as an independent unit and created a rule engine to execute them. Each rule implements a common interface:

interface Rule { RuleResult evaluate(Expense expense); }

The engine iterates through all expenses and applies all rules:

for each expense: for each rule: evaluate rule if rule says SKIP → stop processing this expense if rule says FLAG → mark it Finally,

**return** all flagged expenses.

Followup question by interviewer was If we keep adding more rules in the future, we’ll end up creating a new class for every rule. 👉 Won’t this lead to too many classes (class explosion)? 👉 How would you redesign this to keep it scalable and maintainable? Would love to hear how others would approach this - especially in real-world systems.

About This Question

This is a reported interview question from a amazon interview for a swe role during the system design round reported in 2026.

It covers the following topics: System Design .

Difficulty rating: Easy