## Microsoft Interview Question for SDE1s

Country: United States

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

if the points are all the same or lie in a straight line, then it is not possible
To check if the three points can form a triangle, check the slopes of any two of the edges
like ((y2-y1)/(x2-x1))
ie if the slopes are equal then the points are on a line and cannot be part of a triangle.

To find outer 'normal' circle area:
1. find the centroid of the triangle (ie ((N1+N2+N3)/3, (M1+M2+M3)/3)
2. find the distance between the centroid of the triangle and any of its vertices (ie sqrt((x2-x2)^2 + (y2-y1)^2). This is the radius of the outer 'normal' circle
3. Calculate the area of the normal circle and store it in a variable, say double normalArea

To find inner 'strange circle' area:
1. find midpoint of any one of the triangle edges (ie (x1+x2)/2, (y1+y2)/2)
2. Measure the distance between this midpoint and the centroid of the triangle. This is the radius of
the inner 'strange' circle
3. Calculate its area (pi*r^2)

To find ring area: subtract the inner area from the outer area and return.

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

s32.postimg.org/sm75dimol/hurdle1.jpg

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

if the points are all the same or lie in a straight line, then it is not possible
To check if the three points can form a triangle, check the slopes of any two of the edges
like ((y2-y1)/(x2-x1))
ie if the slopes are equal then the points are on a line and cannot be part of a triangle.

To find outer 'normal' circle area:
1. find the centroid of the triangle (ie ((N1+N2+N3)/3, (M1+M2+M3)/3)
2. find the distance between the centroid of the triangle and any of its vertices (ie sqrt((x2-x2)^2 + (y2-y1)^2). This is the radius of the outer 'normal' circle
3. Calculate the area of the normal circle and store it in a variable, say double normalArea

To find inner 'strange circle' area:
1. find midpoint of any one of the triangle edges (ie (x1+x2)/2, (y1+y2)/2)
2. Measure the distance between this midpoint and the centroid of the triangle. This is the radius of
the inner 'strange' circle
3. Calculate its area (pi*r^2)

To find ring area: subtract the inner area from the outer area and return.

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.