Stripe Coding Interview: Transaction Rule Engine

Based on a candidate's reported Stripe interview

The interviewer opens

Welcome, and thanks for joining this interview for the Staff Software Engineer role at Stripe. We'll work through a coding problem together, and I'd like you to think out loud as you code. If you need to step out or take a break, you can pause the interview any time with the Pause button at the top right of your screen.

The problem is about screening payment transactions against deny rules, the kind of check a risk system runs. It's in the Problem tab on the right, so please read it through and ask me any questions before you start.

The problem

A payments risk engine screens transactions against deny rules.

  • transactions: list of transactions, each a map from attribute name to string value (e.g. {"amount": "1500", "country": "US"}).
  • rules: list of conditions, each written field op value with single spaces, where op is one of ==, !=, >, <, >=, <=.

A transaction is DENY if any rule's condition holds for it, otherwise ACCEPT. == and != compare as strings; the other operators compare both sides as integers. Every field named in a rule exists in every transaction, and values contain no spaces. Return one decision per transaction, in order.

Example: transactions = [{"amount":"1500","country":"US"},{"amount":"200","country":"BR"},{"amount":"50","country":"US"}], rules = ["amount > 1000","country == BR"] → ["DENY","DENY","ACCEPT"]

Sizes: up to 10^4 transactions, up to 100 rules.