A dunnhumby retail data pipeline compares two sorted snapshots of integer identifiers. The first snapshot contains every value, while the second contains the same multiset with exactly one occurrence removed. Find the missing value without modifying either array.
Your solution must handle duplicate values, negative values, and a missing value at any position. Because the arrays may be very large, target O(log n) time and O(1) additional space.
Implement find_missing(first, second):
first, an ascending nondecreasing list of integers with length n; second, an ascending nondecreasing list of integers with length n - 1.first but not in second.def find_missing(first, second):