Goldman Sachs Interview Question for Software Engineer / Developers






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

distance 'd' will be between 0 < d < 1

- Anonymous February 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1/3

I can write a simple program to get this answer, but it's hard for me to mathematically prove it.

- Jie February 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Let me try to prove it mathematically:

let's assume the position of the first point is y (0<=y<=1). So the probability dense function of the distance to the second point is:
f(x) = 2, o<=x<=y
f(x) = 1, a<x<=1-y
therefore, we can get the expectation as: definite integral (x*f(x))dx from 0 to 1, and get E(x) = y*y-y+1/2 (here y is a parameter).
Now we need to compute the expectation of E(x) given all the possible values of y.
Then according to the Central limit theorem, we can calculate the expectation as: definite integral (y*y-y+1/2)dy from 0 to 1 (here y is a variable), and get result as 1/3.

Not sure if this is a correct proof.

- Jie February 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

You don't need Central Limit, just the definition of expectation with respect to the uniform probability measure.

- Anonymous February 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assume a uniform distribution between 0 and 1. Let f(x) = 1, for x in [0, 1].
Then the joint density of two point x, y is f(x,y)=f(x)f(y)=1, for x,y in [0,1].

Compute the integral (in Tex script)
\int_0^1 \int_0^1 |x-y| f(x,y) dxdy = \int_0^1 \int_0^1 |x-y| dxdy = ... = 1/3

- Anonymous February 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

E[x] = Integral[x*(1-x^2)^1/2] from limits 0 to 1.. = 1/3
since f(x,y) = x^2 + y^2 - 1

- Rocky February 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Let a and b be random, uniformly distributed variables such that 0<=a<=1 and 0<=b<=1. These are our two points on the line. We can say that the expected distance between the two points is the expected probability that a third, randomly distributed point, c, 0<=c<=1 lies between a and b. c is no different from a and b so the odds that c lies between a and b is 1/3.

- Anonymous March 30, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

quite a simple and efficient xplanation.! gr8

- Anonymous August 08, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Anonymous nice but I couldn't get.

- S&S July 24, 2010 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More