Compute max diff in series in O(n) time.