It is not possible to have the solution in O(log N) time because we are not exactly sure about which value we are looking, So a binary search is meaningless. As for the last solution, why should we even try and find a sum and deduct etc. That would be more work than necessary. Also, a contiguous sequence can be A.P, G.P or anything, so a way to do this would be to iterate over the array, predict the next value, and then check if the current value in array is same as the predicted value. If they are same, move to the next element, else we found the misssing element. It will be an O(N) solution.