find the missing number in a block of 3 numbers
Your current algorithm is linear in the size of your array $A$, which I'll call $n$. We can do a bit better, by observing the following: If some index $3i-1$ comes before the missing number, then $A[3i-1]=i$. Otherwise, $A[3i-1]=i+1$. (I start indexing at $0$) 

So, we can do a binary search on $i$, as we always can see whether the index of the missing number is larger or smaller than $3i-1$. This gives an $O(\log n)$ algorithm, which is an improvement on your linear time algorithm.