HARDVerified Real Interview• Risk & Fraud Analytics Engineer
Repeated Payments Within 10 Minutes
Verified Source:Stripe Risk Engineering Interview
Stripe's Risk & Fraud engineering team wants to identify potential double-charging bugs or fraudulent card attacks.
A repeated payment is defined as a transaction that has the same merchant_id, credit_card_id, and amount, occurring within 10 minutes or less of an immediately preceding transaction with those same attributes.
Write a query to count the total number of repeated payments across the entire dataset.
Table:
transactions(transaction_idINT,merchant_idINT,credit_card_idINT,amountDECIMAL,transaction_timestampTIMESTAMP)
Execution Sandbox:
Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.
Standard SQL (ANSI)|Ln 1, Col 1(7 lines, 115 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.