ENG-DSA-011Ledger Reconciliation (Two Pointers)
00:00
🐍 Python Idle
Mode:Web

Ledger Reconciliation (Two Pointers)

CompaniesStripe, Square
Est. Time~20 min
LevelJunior
Two PointersArraysMath
🚨 P0 Incident
StripeSquare

Square's finance team runs a nightly reconciliation job to match transaction amounts across their ledger. They have a sorted array of transaction amounts and need to find if any two amounts sum to the day's target discrepancy. The naive O(n²) approach would take hours on large ledgers.

📥 Assigned to:You — Junior Engineer
Your Task

Finance is running a daily reconciliation job. We have a sorted array of transaction amounts. Find if there are two distinct transactions that sum exactly to our daily target discrepancy. Return their indices.

⏱ Time: O(n)💾 Space: O(1)
Example 1
Input:  transactions=[10, 20, 30, 40, 50], target=70
Output: [1, 4] (20+50) or [2,3] (30+40)
Example 2
Input:  transactions=[5, 10, 15, 20], target=100
Output: []
🔒 +3 hidden test cases — revealed on Submit
Hints
Loading editor…
Test Output
▶ Run Code to test against examples · Submit to judge all 5 test cases
EngPrep — Real Engineering. Real Interviews.