Flipkart Interview Question
Software Engineer / Developerssounds correct. if all bases are equal, and height anyway is the same, then all areas are definitely equal.
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 !
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.
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
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.
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.
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.
How about dividing the base in 7 equal parts?
- Anonymous October 15, 2010