find missing value from n continuos numbers. they say it as algorithm question
Respuestas de entrevistas
Anónimo
20 mar 2018
sum of n continuous numbers from algebra.( n*n+1)/2. loop through each value and subtract from sum. at last you will have missing value
1
Anónimo
10 abr 2018
Worst case complexity for above solution is O(n). Bettet solution is to binary search approach which has worst complexity as O(log n).
If middle is not as expected, then missing number is in left side of middle number. Apply the same on sub-array on left side