Amazon Interview Question
Software Engineer / DevelopersI do think 8 is the correct answer.
But could you please explain how you arrived at
(6x4x2)/(3x2x1)
I got my answer by brute force approach. I am now trying to find a formula::))
I do think 8 is the correct answer.
But could you please explain how you arrived at
(6x4x2)/(3x2x1)
I got my answer by brute force approach. I am now trying to find a formula::))
To form an acute triangle you can only choose vertices that are not connected by an edge to each other in the cube. There are two sets of 4 such vertices (diagonals on the first face and the opposite diagonal on the bottom face). In each such set choosing any 3 would form an acute Triangle. So the answer would be 2*4C3 = 8.
it is 24
in every face we can form 4 acute triangles.
there are six faces...so 6*4 = 24
please correct me if I am wrong....
Assumption: It'a an equi cube( all edges are of equal length and you can't distinguish between any two sides/edges).
The Answer is 3
1) you can select 2 vertices of an edge, and select the third vertix as one of
vertices of diognally opposite edge. (2 ways).
2) you can select 3 vertices in such a way that no two are on same edge. (only one
way)
There are total of 24 Acute Triangles in a Cube
------1--------2
3--------4
------5--------6
7--------8
(1-2-3-4)
1-4-7,----->[[1]]
1-4-6,------->[[2]]
2-3-5,--------->[[3]]
2-3-8,----------->[[4]]
(2-6-8-4)
2-8-3,----------->(4)
2-8-5,------------->[[5]]
4-6-1,------->(2)
4-6-7,----------------->[[7]]
(1-2-5-6)
1-6-7,--------------->[[6]]
1-6-4,------->(2)
2-5-3,--------->(3)
2-5-8,------------->(5)
(1-5-3-7)
1-7-4,----->(1)
1-7-6,--------------->(6)
3-5-2,--------->(3)
3-5-8,------------------->[[8]]
(3-4-7-8)
3-8-5,------------------->(8)
3-8-2,----------->(4)
4-7-1,----->(1)
4-7-6,----------------->(7)
(5-6-7-8)
6-7-1,--------------->(6)
6-7-4,----------------->(7)
5-8-2,------------->(5)
5-8-3,------------------->(8)
But, Unique Triangles are 8.
1-4-7,----->[[1]]
1-4-6,------->[[2]]
2-3-5,--------->[[3]]
2-3-8,----------->[[4]]
2-8-5,------------->[[5]]
1-6-7,--------------->[[6]]
4-6-7,----------------->[[7]]
3-5-8,------------------->[[8]]
Total number of triangles that can be formed = 8C3 = 56
Each diagonal on each surface of the cube gives rise to 2 right angled triangles, and there are two such diagonals for each surface and 2 * 6 = 12 such diagonals
Therefore, total number of right angled triangles = 12 * 2 = 24
The rest of them are acute angled triangles i.e, 56 - 24 = 32
ans: 24 ?
total faces: 6
each face: 2 diagonals.
with each diagonal - 2 equil triangle with the diagonals of the adjacent sides to it
=> 6*2*2 = 24 !!
correct me if im wrong :)
Acute angled triangle can be formed by connecting the diagonal of three adjacent faces of the cube.
- Tulley March 22, 2011The number of ways three adjacent faces can be chosen is (6x4x2)/(3x2x1) = 8
So the total number of acute angled triangle is 8.