Python data engineering interview problem. Difficulty: intermediate. Pattern: Hashing. About 15 minutes. Part of the Pro drill bank.
Two ledger lines should pair when their amounts add to a target transfer size. Accounting wants those two indices (or values) if they exist.
Find two amounts that add to the target transfer (two-sum on the list).
Input: complementary_pair([1, -1, 2]) Output: [0, 1] This input follows the stated rules and produces this output.
Topics: lakebench, python, hash-based-problems.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given a list of transfer amounts, find a pair that sums to exactly zero net movement.
Find two amounts that add to the target transfer (two-sum on the list).