Reconcile Trade Confirmations Against Booked Trades With Price Tolerance

Last updated: November 29, 2026

Quick Overview

Given your booked trades and a counterparty's confirmations as (trade_id, isin, side, quantity, price), match them one to one where ISIN, side and quantity agree exactly and prices differ by at most a tolerance, maximizing the number of matches and listing the unmatched trades on each side.

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

0

0

0 solved


Given your booked trades and a counterparty's confirmations as (trade_id, isin, side, quantity, price), match them one to one where ISIN, side and quantity agree exactly and prices differ by at most a tolerance, maximizing the number of matches and listing the unmatched trades on each side.

Post-trade matching and reconciliation is core to TCS BaNCS for capital markets and to the custody and settlement work TCS does for brokers. The interviewer is checking whether the candidate groups by exact keys first and then sees the sorted two-pointer greedy, rather than a nested loop that can also produce a suboptimal matching.

What the Interviewer Expects
  • Group by exact match keys before comparing prices
  • Sort prices within each group
  • Use a two-pointer greedy that discards the smaller unmatched side
  • Explain why greedy maximizes matches for tolerance matching
  • Report unmatched on both sides for operations follow-up
Key Topics to Cover
Hashing
Sorting
Two pointers
Greedy matching
Reconciliation
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 do you handle one booked trade confirmed as two partial fills?
  • How would you use decimal prices and a tolerance in basis points?
  • How would you reconcile a day's 50 million trades across machines?
  • Which mismatches should auto-resolve and which go to a human queue?
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

A pair matches if isin, side and qty are equal and |p_ours - p_theirs| <= tol. Each trade matches at most once. Maximize matches; return matched pairs, unmatched ours, unmatched theirs....

High-Level Design

Bucket both lists by (isin, side, qty). Within a bucket, only price matters, so the problem becomes maximum matching of two sorted number lists under a tolerance. Walk both sorted lists: if the head...


Submit Your Answer
Markdown supported

Related Questions