← 返回 stripe 的题目列表Merchant Fraud Score (OA)
类型:qbank
OA. Given transactions, fraud-scoring rules, and a baseline merchant score, compute each merchant's final fraud score by applying rule contributions over their transactions.
Requirements
Inputs:
transaction = ["merchant1,980,customer1,15", ...] — each row contains merchant_id, amount, customer_id, and a timestamp.
rules = ["1500,2,8,12", ...] — each rule contains a threshold and a set of additive score numbers (e.g. +2, +8, +12) keyed off some property of the transaction.
merchants = ["merchant1,20", ...] — base score per merchant.
Output: ["merchant1,50", ...] — final score per merchant after applying all matching rules across that merchant's transactions.
Notes
Prompt is long; the rule grammar is the most ambiguous piece — exact rule semantics are not fully recovered from community posts.
Estimated 50 lines of code per the source report.
Preparation
Drill rule-engine problems: parse a list of rules, group transactions, accumulate per-entity totals.
Pre-write a small apply_rule(transaction, rule, current_score) skeleton so you can compose rules in Part 2.
Practice CSV-by-hand parsing and integer arithmetic; do not assume floats.