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.
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.
▶ Run Code to test against examples · Submit to judge all 5 test cases