Loading page…
Kestrel Pay must find which two payments in a batch of 100,000 add up to a disputed total. Trying every pair makes about 5 billion checks and takes about 50 seconds. A hash set remembers the values already read, and a hash map from value to position turns each question into one lookup: the complement, the target minus the value. Look first and store afterwards, keep the first position, and the pass costs O(n) time.
Kestrel Pay settles a batch of payments every night.