“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
You can’t cut the cake horizontally if the rectangle removed does not go all the way to the bottom of the cake. (for instance if they only remove the first layer of a layered cake)
Submitted By: Debadyuti Banerjee — October 30, 2006
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
If you cut a cake by connecting the centers there are cases left where that will cut it into 3 unequal slices. yes 2 of them equal the other. But thats not what the question asks, so I say this question might not have an answer.
The question is ill-formed because “equals” has not been defined. As any good programmer knows, equality could mean identity or equivalence under any number of relations. In this case, does “equal pieces” mean the same volume? Same shape? Same mass (you assumed the density of the cake is uniform, didn’t you)?
As Bob notes, it is possible to take a long, thin rectangle from near the top of the cake that is almost as wide as the cake, but forces the cake to have a ‘C’ shape with a thick bottom. Now if you cut through the middle of both rectangles, you will essentially be cutting across the ‘C’ vertically, which will result in 3 pieces. Topologically speaking, this is very different from 2 pieces, which is why “equal pieces” needs to be more specifically defined.
The fact that the one prescient answer received a negative vote while the naive answers received positive ones proves that anyone using this site is unlikely to be taken seriously as a programmer (though I certainly hope Microsoft feels otherwise).
The most important part of every solution to this problem is to find the cake’s center of mass since any straight cut passed (only) through that point divide the cake into two equal pieces.
In the most difficult case when a cake and holes have pretty wrong shapes the best (and easiest) solution would be to accurately shift the cake towards an edge of a table to the very point when it is almost out of balance. So the table’s edge is the line of cut (precise enough).
slice the cake half-way through the depth of the cake (look through the side of the cake). This way no matter what size the slice removed is or where it is removed, you will still have two equal pieces.
First thing would be to define the equal.
So, if we’re talking about a cake:
1. Usually the cake is made of layers, so cutting in between layers is no good (also think at cutted rectangular may not be the whole depth)
2. Cakes are made to be eaten
Following would be my definition of equality:the same amount of volume from any goodies inside.
this implies that the cut should be “vertical”.
Remember that this is an elementary problem from geometry, where they ask about area, and do not refer specificcaly at number of pieces. So, we may define a piece as the amount of cake that should go to different plates.
Now the natural answer (#1):
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
“Bill Gates” has the only valid answer. Since equal is not specifically defined, there can be many types of the right answer. Companies like Google and Microsoft actually look to see if you can recognize that the answer can vary because of its ambiguity. However, they also want you to be able to solve the problem once the ambiguity is defined.
any plane that passes through the center of a cuboid will definitely make the cuboid split into two halves which will be equal in size and similar in shapes.
Provided a cuboid is cutout from the cake. If you can find the center of original cuboid and cutout piece and make a plane of theses two points and make a cut the remaining cake will be definitely of equal size and similar shape.
Because
assuming the cut has made before the piece has been removed that would have given us equal and similar pieces. Out of the rectangular cuboid removed, if we make cut through its center, even the removed piece would have got into two pieces. Here actually we are sharing the loss of that piece by including that centre also.
Moreover the problem can be extended what if two rectangular pieces of cakes been removed the original cake and allowed to make a single cut to make the cake to equal halves. There we have to form a plane having the center of three, the original amd that of two cutout pieces.
“a rectangular cake”, as rectangle shape is known, so shall the equal definition is know as in geometrical manner. Question says rectangular (we have no idea about depth, so assumption should be it is 2D, and whoever eats those cakes are cartoon characters living in a 2D world, (no time dimension there!!) ) . So helpmefindjob (1), states the correct answer in these conditions.
You need two points that are level and can support the cake (fingers may have to do).* Adjust the points and the cake until it balances (you can push your fingers closer together to do this; the minimal amount of friction is present when they’re moving towards its center of gravity. Then cut along a) the line formed by connection the points, or b) cut out the plane formed by those two points and any point on the line formed by either point and earth’s center of gravity.
* This assumes the cake is on a pan or other sturdy surface.
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
You could cut the cake horizontally!
You can’t cut the cake horizontally if the rectangle removed does not go all the way to the bottom of the cake. (for instance if they only remove the first layer of a layered cake)
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
If you cut a cake by connecting the centers there are cases left where that will cut it into 3 unequal slices. yes 2 of them equal the other. But thats not what the question asks, so I say this question might not have an answer.
How can a single slice ever produce three pieces?
The question is ill-formed because “equals” has not been defined. As any good programmer knows, equality could mean identity or equivalence under any number of relations. In this case, does “equal pieces” mean the same volume? Same shape? Same mass (you assumed the density of the cake is uniform, didn’t you)?
As Bob notes, it is possible to take a long, thin rectangle from near the top of the cake that is almost as wide as the cake, but forces the cake to have a ‘C’ shape with a thick bottom. Now if you cut through the middle of both rectangles, you will essentially be cutting across the ‘C’ vertically, which will result in 3 pieces. Topologically speaking, this is very different from 2 pieces, which is why “equal pieces” needs to be more specifically defined.
The fact that the one prescient answer received a negative vote while the naive answers received positive ones proves that anyone using this site is unlikely to be taken seriously as a programmer (though I certainly hope Microsoft feels otherwise).
The most important part of every solution to this problem is to find the cake’s center of mass since any straight cut passed (only) through that point divide the cake into two equal pieces.
In the most difficult case when a cake and holes have pretty wrong shapes the best (and easiest) solution would be to accurately shift the cake towards an edge of a table to the very point when it is almost out of balance. So the table’s edge is the line of cut (precise enough).
slice the cake half-way through the depth of the cake (look through the side of the cake). This way no matter what size the slice removed is or where it is removed, you will still have two equal pieces.
First thing would be to define the equal.
So, if we’re talking about a cake:
1. Usually the cake is made of layers, so cutting in between layers is no good (also think at cutted rectangular may not be the whole depth)
2. Cakes are made to be eaten
Following would be my definition of equality:the same amount of volume from any goodies inside.
this implies that the cut should be “vertical”.
Remember that this is an elementary problem from geometry, where they ask about area, and do not refer specificcaly at number of pieces. So, we may define a piece as the amount of cake that should go to different plates.
Now the natural answer (#1):
You need to make sure that your cut passes through the center of both rectangles. Find the center of each rectangle, and then cut a line that runs between them. If both rectangles have the same center, then you can cut at any angle that goes through the center.
“Bill Gates” has the only valid answer. Since equal is not specifically defined, there can be many types of the right answer. Companies like Google and Microsoft actually look to see if you can recognize that the answer can vary because of its ambiguity. However, they also want you to be able to solve the problem once the ambiguity is defined.
To be simple
any plane that passes through the center of a cuboid will definitely make the cuboid split into two halves which will be equal in size and similar in shapes.
Provided a cuboid is cutout from the cake. If you can find the center of original cuboid and cutout piece and make a plane of theses two points and make a cut the remaining cake will be definitely of equal size and similar shape.
Because
assuming the cut has made before the piece has been removed that would have given us equal and similar pieces. Out of the rectangular cuboid removed, if we make cut through its center, even the removed piece would have got into two pieces. Here actually we are sharing the loss of that piece by including that centre also.
Moreover the problem can be extended what if two rectangular pieces of cakes been removed the original cake and allowed to make a single cut to make the cake to equal halves. There we have to form a plane having the center of three, the original amd that of two cutout pieces.
“a rectangular cake”, as rectangle shape is known, so shall the equal definition is know as in geometrical manner. Question says rectangular (we have no idea about depth, so assumption should be it is 2D, and whoever eats those cakes are cartoon characters living in a 2D world, (no time dimension there!!) ) . So helpmefindjob (1), states the correct answer in these conditions.
Cut the cake on the half way to the HIGHT axis.
Cut the cake to 3 (or 2) rectangulars and half the pieces through diagonal.
cut along a line which passes through the centers of both reactangles
You need two points that are level and can support the cake (fingers may have to do).* Adjust the points and the cake until it balances (you can push your fingers closer together to do this; the minimal amount of friction is present when they’re moving towards its center of gravity. Then cut along a) the line formed by connection the points, or b) cut out the plane formed by those two points and any point on the line formed by either point and earth’s center of gravity.
* This assumes the cake is on a pan or other sturdy surface.
Leave an Answer/Comment