Flag Accidental Duplicate Transfer Submissions
Last updated: November 29, 2026
Quick Overview
Given a time-ordered stream of transfer submissions, flag any that repeat the same sender, recipient, and amount within a short window of the last accepted one, so the app can ask the customer to confirm before charging twice.
Remitly
November 29, 20260
0
0 solved
Given a time-ordered stream of transfer submissions, flag any that repeat the same sender, recipient, and amount within a short window of the last accepted one, so the app can ask the customer to confirm before charging twice.
On flaky mobile connections customers sometimes tap Send twice or retry after a timeout, and a remittance app must not move money twice. This is a hashing warm-up that checks you can define the duplicate key and window precisely and distinguish it from true API idempotency keys.
What the Interviewer Expects
- Defines a clear composite key for duplicates
- Compares against the last accepted submission, not the last seen
- Handles the window boundary deliberately
- Runs in linear time with a hash map
- Explains how this differs from an idempotency key on the API
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you bound memory for millions of senders?
- Should a duplicate flag block the transfer or prompt the customer? Who decides?
- How would you implement true idempotency for retried API requests?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Events are sorted by timestamp. A submission is flagged when there is an earlier accepted submission with the same (sender, recipient, amount) and the gap is strictly less than the window. Flagged s...
High-Level Design
One dictionary from key to timestamp of the last accepted submission. Walk the stream once....