## Flipkart Interview Question for Software Engineer / Developers

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

How about dividing the base in 7 equal parts?

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

sounds correct. if all bases are equal, and height anyway is the same, then all areas are definitely equal.

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

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

best.. :)

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

The areas are equal, but they are not triangles...

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

perfect dude :)

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

@sharon, join the base points to the vertex.
Dont form trapezoids :)

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

And btw, its asking for equal (congruent) triangles and not the ones with just equal areas.
Found this,
"Using the property of the col-linearity of ortho-center, centroid, circum-center. We can get 7 non-overlapping triangles. For that matter if we include nine point center also we can get another two more non-overlapping triangles."

Its a core olympiad problem, should not have been asked in a tech interview !

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

Equal if atleast 2 side of triangle are equal !!

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

using the property of the collinearity of orthocenter,centroid,circumcenter.we can get 7 nonoverlapping traingles.for that matter if we include ninepoint center also we can get another two more nonoverlapping triangles.

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

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

suppose ABC is the triangle,with BC as base.its centriod G,circumcenter S,
orthocenter O
now 7 triangles are BSC,BSG,CSG,BGO,CGO,BOA,COA

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

What will be in case of right triangle?

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

why will they all be the same Area, any mathematical proof

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

This is not correct, for an equilateral triangle all 3 points are the same. For a right angle triangle vertex is itself the ortho-center.

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

I think by equal it is not area but identification itself.
If we shuffle the 7 triangles we should not be able to identify which triangle is got from which part of the main triangle.
In mathematical terms two triangles are equals if they obey SAS or ASA rule.

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

If it is equal by area below is the solution.

1. Calculate the area of whole triangle (say A)
2. One seventh of A will be area of smaller triangles (say a)
3. We need to find 3 points D, E and F inside the triangle so that ABD, BDE, BEC, CEF, CFA, AFD and DEF are the triangles equal by area.
4. Point D will exist on the line parallel to line AB at a height hd which we can calculate as below
Area of triangle ABD = AB * hd / 2 = a
hd = 2 * a / AB
5. Similarly E will exist on line parallel to line BC at a height he = 2 * a / BC
6. Similarly F will exist on line parallel to line CA at a height hf = 2 * a / CA
7. Now we got 3 lines on which D, E and F lie one on each line.
8. Say these 3 lines intersect at points A', B' and C'
9. Now we can say that D, E and F lie on line segments A'B', B'C' and C'A'
10. Now using binary search we can find the point D thereby finding points E and F.
11. Take the midpoint of line segment A'B' as D.
12. Now do a binary search on line segment B'C' such that area of triangle DBE = a
13. Similarly do a binary search on line segment C'A' such that area of triangle CEF = a
14. Now if area of triangles ADF = DEF = a then this is our solution
15. If area of triangle ADF > a > DEF then actual D should be some where in the line segment DA', so now take D as the mid point of DA' and countinue from step 12.
16. If area of triangle ADF < a < DEF then actual D should be some where in the line segment DB', so now take D as the mid point of DB' and countinue from step 12.

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

To find points E and F we can come up with a formula rather than doing a binary search.
Complexity of the solution depends on the precision of the answer (p) and the length of the sides of the triangle (l). We need log(l*(10^p)) iterations to find the solution. If the distance is around 10 and we need precision to 2 decimals then we need to binary search 1000 points which will take log(10*(10^2)) = log(1000) iterations.

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

Equal triangle does not just mean equal in area.
equality implies congruency: i am not sure how to divide a triangle into 7 congruent triangles. maybe some clarification needed is it being asked to divide into just 7 equal areas

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

dividing the base is perfect

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

Dividing the Base is perfect

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

What if base is not divisible by 7 ???

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

What if the area is not divisible by 7 ?

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.