Bloomberg LP Interview Question for Financial Software Developers






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

Imagine that the cube was a cardboard box, and the box could be opened to make the cardboard sheet. now connect the opposite points. the diagonal is the shortest path.

- champaklal June 17, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

According to Gautam -
2 * sqrt { r*r + (r/2)*(r/2) }
= 2 * sqrt { r*r + r*r / 4 }
= 2 * sqrt { r*r *( 5 /4 ) }
= 2 * r * sqrt (5/4)
= r * sqrt (5)
~ r * 2.2360679774997896964091736687313

Accroding to Mandar -
r *(1 + sqrt (2))
~ r * 2.4142135623730950488016887242097

So mandar's way of calculating along surface digonal is not shortest. He should calculate from vertex to mid of any of the adjusant edge of the opposite vertex of that surface and then from there to the oppsite vertex.

for simplicity take a thread and simple cube and try how that thread want's to travel when you tie it from one vertex to another, it will stay on any side of the cube but will sleep down to the mid of the edge.

- sachin.magdum July 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice soln

- seeker7 July 15, 2010 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

This is a very old question. And the correct question has no calculus of other big math things in it. The solution has been given. Imagine the cube to be a flat surface. As if the cube is a room/box and all its side are put flat. Now use SIMPLE Pythagorus theorem to get the answer as sqrt(side*side + side*side)

Companies like these do not want Calculas and integration solutions. Simple solutions.

- X March 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

champaklal is guru...

This distance evaluates to 1 + sqrt(2)

- Patel Scope June 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I'm sorry but this evaluates to sqrt(5) = sqrt(1*1+2*2).
_|_|_ _
|_|_|_|_|
|_|

- S June 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 2 vote

The distance is : (1 + sqrt(2) ) * Side of cube

- Anonymous June 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

Actually, the answer is sqrt(5)

- Gautam June 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I also got sqrt(5)...

1+sqrt(2) ~ 2.41
sqrt(5) ~ 2.24

- heretic June 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

since we can only traverse thru the surface so it has to be sqrt(2)+1,but along the diagonal i.e. interior wud be sqrt(5)

- seeker7 June 29, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

No. Here are all answers for all possible cases.
(Note : I have taken 'r' as side length of the cube.
Interior(If you cut through): srqoot(3)*r
Exterior(Along Edges):3*r
Exterior(shortest along the surface):sqroot(5)*r

Heretic and gouti are correct!

- nagabhushana.s July 01, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

"how do you find the shortest distance (find a formula) for two points on the opposite vertices of a cube (shortest distance is actually sqrt(3) but can't cut through interior, must go along surface of cube)"

Shortest dist sqrt(3) means here the points should be end points of the diagonal. If we cant go through a diagonal (of a cube which is not present in any surface), then we must go through one diagonal of a surface (side*sqrt(2)) and one side.
So answer is (1+sqrt(2))*side

- Psycho September 04, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Answer is 2*(sqrt(1+0.5*0.5))..

i.e. sqrt(4*1.25)= sqrt(5)

- Abhijit October 27, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The distance is (1 + sqrt(2)) * Side of cube

- Mandar June 20, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

x*sqr(x)

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

Guatam is correct!

- nagabhushana.s July 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

do it using calculus, guys.
suppose you are finding the shortest between A and B, I set a point C in the opposite side of A, whose distance to nearest end is x. Then the distance is

dist = sqrt(a^2+x^2) + sqrt(2a^2-x^2)

ask ddist/dx=0 to obtain the min value. Then x = a/sqrt(2)
and dist = a*sqrt(6)

=======================================================
however, this is the MAX distance, the MIN one is a*sqrt(5)

- beyondfalcon August 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I agree. The ans is r*sqrt(5)

- Sid November 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

say each side of a sqare is a.

the on the surface we have to travel one diagonal, and one side.
hence, the solution is (a+sqrt(2)*a)

- Anonymous March 20, 2016 | 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