Flag Possible Duplicate Vendor Payments in Accounts Payable

Last updated: November 29, 2026

Quick Overview

Given a list of vendor payments with id, vendor, amount, day number and free-text invoice number, return every pair of payments that is likely a duplicate: same vendor and amount within a 7 day window, or same vendor and the same invoice number after normalization.

Deloitte
Coding & Algorithms
Software Engineer
Deloitte
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given a list of vendor payments with id, vendor, amount, day number and free-text invoice number, return every pair of payments that is likely a duplicate: same vendor and amount within a 7 day window, or same vendor and the same invoice number after normalization.

Duplicate payment detection is a classic accounts payable analytic that audit and forensic teams run over client ledgers, and it maps directly to the journal analytics Deloitte builds into its audit tooling. The interviewer is checking that you group before comparing, use a sliding window instead of all pairs, and think hard about messy invoice numbers.

What the Interviewer Expects
  • Groups by (vendor, amount) and by (vendor, normalized invoice) before comparing
  • Uses sorting plus a sliding window for the date rule
  • Normalizes invoice numbers (prefixes, punctuation, leading zeros) deliberately
  • Deduplicates pairs flagged by both rules and records the reason
  • Discusses false positives such as recurring fixed-fee invoices
Key Topics to Cover
grouping
sliding window
string normalization
fraud analytics
accounts payable
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Monthly rent to the same landlord is the same amount every month. How do you avoid flagging it?
  • How would you catch near-duplicates where one digit of the amount was mistyped?
  • How would you rank flagged pairs so an auditor reviews the riskiest first?
  • How would you run this across 200 million payments in Spark?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each payment: id, vendor, amount_cents, day, invoice. Two rules:

  1. Same vendor, same amount, days at most window_days apart.
  2. Same vendor, same normalized invoice number, any amount (a partial ...
High-Level Design

Comparing all pairs is O(n^2) over a client's whole AP history, which is far too slow. Instead bucket by (vendor, amount); inside each bucket sort by day and slide a window so each payment only meet...


Submit Your Answer
Markdown supported

Related Questions