The Missing Number In Arithmetic Progression problem gives you an array that should form an arithmetic progression (equal difference between consecutive terms) but has exactly one number missing. Find the missing number. This Missing Number In Arithmetic Progression coding problem tests your ability to identify the common difference and locate the gap using binary search or linear scan.
Audible asks this to test understanding of arithmetic progressions and the ability to derive the common difference from the first and last elements — even when the full sequence is incomplete. The array and math interview pattern is applied cleanly, and the problem rewards precise reasoning about expected vs actual values.
Determine common difference + binary search. The expected difference d = (arr[n-1] - arr[0]) / n. Then binary search: at index i, expected value = arr[0] + i * d. Find the first index where arr[i] != arr[0] + i*d. The missing number is arr[i-1] + d.
Array: [2, 4, 8, 10, 12]. Expected difference = (12-2)/5 = 2. Wait, let me check: n=5, last=12, first=2, d=(12-2)/5=2. Check index 2: expected = 2+2*2=6, actual = 8. Mismatch at index 2. Missing = arr[1]+d = 4+2 = 6.
arr[1] - arr[0] (wrong if the missing number is the second element).(arr[n-1] - arr[0]) / n as the safe formula for d.For arithmetic progression problems, always compute the common difference from the endpoints (last - first) / n rather than adjacent elements — a missing early element corrupts the local difference. This is a fundamental insight for all arithmetic sequence gap problems. After solving this, practice finding multiple missing numbers or verifying whether an array can form an AP with rearrangement.