## Goldman Sachs Interview Question for Analysts

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

Any Line passing the centers of the two squares will cut them in halves

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

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

find the centers of the squres and draw a line joining them .

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

then second square will have to be aligned with the diagonal of the first one. best is line through centers of both the squares.

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

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

for squares in 2d plane u would require a plane 2 cut the squares in 2 halves

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

incorrect...
for a square in 3d( a cube) a plane would split them. for a 2d square. u need a line!

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

how about line passing through the diagonals of both the squares?

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

can anybody comment

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

Yes?

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

may be this shud do ..

consider if sq1 is in 1st quad and sq2 is in 3rd quad ..

now reflect the sq2 on x axis so that it falls on 2nd quad... now reflect it again on 1st quad ... so now both squares will be in 1st quad ..now adjust them so that they both lie on each other ,, using rotations ,, displacements .. now draw a line at n/2 .. after cutting .. reverse the process to bring back to quad3..

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

``````public class Square {
public double left;
public double top;
public double bottom;
public double right;
public Square(double left, double top, double size) {
this.left = left;
this.top = top;
this.bottom = top + size;
this.right = left + size;
}

public Point middle() {
return new Point((this.left + this.right) / 2,
(this.top + this.bottom) / 2);
}

public Line cut(Square other) {
Point middle_s = this.middle();
Point middle_t = other.middle();
if (middle_s == middle_t) {
return new Line(new Point(left, top),
new Point(right, bottom));
} else {
return new Line(middle_s, middle_t);
}
}
}``````

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

``code``

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

I think it would make sense for these geometrical tasks to have some drawing. A drawing is worth hundred words.

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.