Three-Way Match Purchase Orders, Receipts and Invoices

Last updated: November 29, 2026

Quick Overview

Given a purchase order's lines, goods-received records, and an invoice's lines, report every exception: items billed but not on the PO, quantity billed above ordered or above received, and unit price outside a percentage tolerance.

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

0

0

0 solved


Given a purchase order's lines, goods-received records, and an invoice's lines, report every exception: items billed but not on the PO, quantity billed above ordered or above received, and unit price outside a percentage tolerance.

Zip's accounts payable product automates invoice approval by matching invoices against purchase orders and receipts before payment. Interviewers use this to see whether you can aggregate messy line-level data, pick the right comparisons, and reason about money tolerance rules that finance teams actually configure.

What the Interviewer Expects
  • Aggregate repeated SKUs across receipts and invoice lines before comparing
  • Separate the distinct exception types instead of returning one boolean
  • Use a relative tolerance on unit price and explain the choice
  • Avoid floating point pitfalls or call them out for real money
  • Return deterministic output for testability
Key Topics to Cover
hash map aggregation
three-way match
tolerance rules
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
  • How would you support partial invoices across several billing cycles against the same PO?
  • Should tolerance be per line, per invoice total, or both?
  • How do you match lines when the vendor uses different SKUs or descriptions than the PO?
  • What changes if shipping and tax lines appear on the invoice?
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

PO lines map SKU to (ordered qty, unit price). Receipts and invoice lines may repeat a SKU. Exceptions: not_on_po, billed_over_ordered, billed_over_received, price_variance (billed average uni...

High-Level Design

Build three maps keyed by SKU: received qty, billed qty and billed amount. Then iterate over the union of PO and billed SKUs in sorted order and run each check independently, so one SKU can raise seve...


Submit Your Answer
Markdown supported

Related Questions