Reported October 2026
Stripesimulation

Transaction Rule Expression Evaluator

Reported by candidates from Stripe's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Stripe OA. Under 2s to a working solution.
Founder's read

Stripe reported this one in October 2026, and the input size is the first thing to read. Up to 10^4 transactions times 10^4 rules, with rules up to 200 tokens each, is a lot of work if you re-parse text for every pair. That's the trap. The task is a small expression evaluator: conditions on amount, country and cardPresent, joined by AND and OR with parentheses. If you blank on the parsing, StealthCoder is the safety net running invisibly during the live OA. Still, the structure is simple once you see it, and you can plan it tonight.

The problem

Evaluate deny rules against transactions. Each transaction row is [id, amount, country, cardPresent], where amount is a non-negative integer and cardPresent is true or false.
Every rule is a space-separated expression. A condition has the form field operator value. Fields are amount, country, and cardPresent. String and boolean fields support == and !=; amount additionally supports <, <=, >, and >=. Parentheses are separate tokens. AND and OR have equal precedence and are evaluated left to right within each parenthesized level.
A transaction is denied when any complete rule evaluates to true. Return id|DENY or id|ACCEPT for each transaction in input order.

Function
evaluateTransactions(transactions: String[][], rules: String[]) → String[]

Examples
Example 1
transactions = [["t1","150","US","false"],["t2","40","CA","true"],["t3","70","US","true"]]
rules = ["amount > 100 AND country == US","cardPresent == false AND amount >= 50"]
return = ["t1|DENY","t2|ACCEPT","t3|ACCEPT"]
t1 matches both deny rules; the other transactions match neither.
Example 2
transactions = [["a","20","US","false"],["b","20","CA","false"]]
rules = ["( country == US OR country == MX ) AND cardPresent == false"]
return = ["a|DENY","b|ACCEPT"]
The nested country expression is true only for transaction a.

Constraints
1 <= transactions.length, rules.length <= 10^4.
Every row has four valid fields and every transaction ID is unique.
Every rule is syntactically valid, has at most 200 tokens, and parentheses are balanced.
Country values are non-empty uppercase ASCII identifiers without spaces.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to parse each rule once and evaluate it many times. Tokenize on spaces, then build a small tree or compile to a closure with a recursive descent parser. AND and OR share equal precedence and run left to right inside each parenthesis level. So you don't need a precedence table. Keep a running result and a pending operator, and recurse when you hit an open paren. The common pitfall is giving AND higher precedence out of habit. That breaks the spec and fails hidden tests. Another is comparing amount as a string, so convert it to an integer. Cardpresent is a string compare against true or false. Then for each transaction, deny if any rule is true, and short-circuit on the first match. Worst case is about 10^4 x 10^4 x 200 operations, so precompiling matters. If the parser gets tangled mid-assessment, StealthCoder can hand you a clean version as a hedge.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Transaction Rule Expression Evaluator cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Stripe's OA.

Stripe reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Transaction Rule Expression Evaluator FAQ

What's the core trick in the Stripe transaction rule evaluator?+

Parse each rule once into a tree or closure, then run it against every transaction. Don't re-tokenize per pair. Treat AND and OR as equal precedence, evaluated left to right at each parenthesis level, which a simple recursive function handles cleanly.

How hard is this problem really?+

It's medium. No fancy algorithm is involved, but the parser has several details that trip people up: nested parentheses, equal precedence, integer comparison for amount, and the boolean field. It rewards careful implementation over cleverness.

Should AND bind tighter than OR?+

No. The spec says AND and OR have equal precedence and go left to right within each parenthesized level. So a OR b AND c means (a OR b) AND c. Writing it the usual way will fail hidden tests.

How do I handle the parentheses tokens?+

They're separate space-delimited tokens, so splitting on spaces is enough. Write a recursive function that reads a condition or a parenthesized group, then loops on AND/OR operators. On an open paren, recurse. On a close paren, return the current result to the caller.

How do I prepare for this in 48 hours?+

Write a recursive descent evaluator for a flat token list with parentheses and a handful of comparison operators. Test the two examples, then edge cases like nested groups and amount equal to the boundary. Also check that you short-circuit on the first denying rule.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Stripe.

OA at Stripe?
Invisible during screen share
Get it