Finding Duplicate Number in an Array
Question is as follows

there is an array
a[1000]
It has values between 0-999 with one value as duplicate rest all are unique.
Is there any way to find that duplicate number in O(log n) complexity.

One way to do it in n complexity is , I will sum the complete array and subtract the sum from the sum(0 to 999)

duplicate number = sum(0 to 999) - sum(a)
but it will be in O(n) complexity.

Only Algo is needed.

Thanks For help
Finding Duplicate Number in an Array
===

Question is as follows

there is an array
a[1000]
It has values between 0-999 with one value as duplicate rest all are unique.
Is there any way to find that duplicate number in O(log n) complexity.

One way to do it in n complexity is , I will sum the complete array and subtract the sum from the sum(0 to 999)

duplicate number = sum(0 to 999) - sum(a)
but it will be in O(n) complexity.

Only Algo is needed.

Thanks For help