## Goldman Sachs Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
1
of 1 vote

the question seems incomplete. u were not provided with more information? on what basis do you plan to check the 100th value? have you to account for repetition? are you searching in any particular way? else you could just pick out the last value as its an array. can anyone clear the confusion?
Arithmetic progression in this case makes no sense as you have not specified any particular sequence in which numbers have been entered or a common difference between the entered numbers.

Comment hidden because of low score. Click to expand.
0
of 0 vote

You're assuming no repeats when the question doesn't state it.

Comment hidden because of low score. Click to expand.
0
of 0 vote

XOR trick

Comment hidden because of low score. Click to expand.
0
of 0 vote

@Vince , If Repeats are allowed will you be able to tell what Exactly will be the 100th number for sure ?

lets say the array has 99 1s ... whats your pick on 100th number ?

Comment hidden because of low score. Click to expand.
0
of 0 vote

have arimetic progression formula n(n+1)/2..
here n= 100..
sum = n(n+1)/2; n=100;
run a loop where sum = sum - a[i]
final value of sum after exiting the loop is the 100th/unknown number...
running time O(n)

Comment hidden because of low score. Click to expand.
0
of 0 vote

They should ban Ganesh or any poster who posted incomplete questions... they should have a flag or rating system here where the poster will be flag by people if the question is incomplete

Comment hidden because of low score. Click to expand.
0
of 0 vote

First clear your head and then jump into water ..

Comment hidden because of low score. Click to expand.
0
of 0 vote

Alternative is using a bitset, bitset[100]. set bitset[a[i]] = 1, now we are left with elements that are not in the array. This also solves repetitions

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````//given *arr of size=99
int findMissingNumber(int *arr, int size) {
int sum=0;
for(int i=0; i<size; ++i) sum+=arr[i];
return (size+1)*((size+2)/2)-sum;
}``````

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.