
Amazon Interview Question - Coin on a Chess Board - Probability Puzzle
video description
The important thing to note is that there are 4 potential outcomes; both axis double colored (the corner, one double color (an edge, the other double (the other axis' edge, and neither double colored (centered in a square. Each axis independently 50/50 split. If either or both of the 2 dimensions hits two colors the condition is satisfied, but if and only if both dimensions come up single color does it fail. Thus the fail rate (single color) is the probabilities multiplied, rather then the success (both colors. Giving you a 25% chance to see a single color, and 75% to see two.
You can also just note there are 4 states with equal probabilities, thus the chance of any single state is 1 in 4, and 3 of them satisfy the condition but this way allows for different sized squares/coins and. more complications. I'd imagine this would easily extend into three dimensions, a sphere of unit 1 tossed into a 3d grid of side unit 2, being ultimately a 7/8ths chance of occupying at least 2 boxes.
Date: 2023-11-15
Related videos
Comments and reviews: 29
raymond
infinately large chessboard? By definition a chessboard is 8x8 squares. so the maximum area size is 16 x 16 = 256. By using the term chessboard you cancel out the word infinately so the chessboard has edges too where the coin can land on. The correct calculation should include the side areas where the centre of the coin could be outside the board. For all side squares together the possible areas would be 4x corner area of 0. 5 x 0. 5 plus 32 x side area of 0. 5 x 1 plus 56 (all side areas x 2 minus 8 corner parts) quarter circles where the coin could be touching one colour. The correct chance should therefore be ( 1 + 16 + ( 14 x 0. 785 == 14 full circles with a radius of 0. 5 = 11 ) + 64) = 92: 256 ==> 35. 9375 % chance of hitting 1 colour and 64. 0625 % of hitting 2 colours. For pi i used 3. 14 only.
reply
infinately large chessboard? By definition a chessboard is 8x8 squares. so the maximum area size is 16 x 16 = 256. By using the term chessboard you cancel out the word infinately so the chessboard has edges too where the coin can land on. The correct calculation should include the side areas where the centre of the coin could be outside the board. For all side squares together the possible areas would be 4x corner area of 0. 5 x 0. 5 plus 32 x side area of 0. 5 x 1 plus 56 (all side areas x 2 minus 8 corner parts) quarter circles where the coin could be touching one colour. The correct chance should therefore be ( 1 + 16 + ( 14 x 0. 785 == 14 full circles with a radius of 0. 5 = 11 ) + 64) = 92: 256 ==> 35. 9375 % chance of hitting 1 colour and 64. 0625 % of hitting 2 colours. For pi i used 3. 14 only.
reply
Tamir
One more excellent video from the factory or AMMAR'S LOGIC INDUSTRIES.
thank you ammar for a very nice riddle, not very hard, but very nice.
btw, what is the chance of this coin to cover only 1 white area, and 1 black area?
(I mean not, for example, on the cross middle of 4 squers, forming 2 white and 2 black areas, like the logo of BMW, and not near the corner, covering 2 black areas and 1 white)
What is the chance to cover ONLY 1 white and 1 black areas? That problem is turning the riddle from Amazon interview question, into NASA interview question.
Can you please, make part 2 to this video, which in you show the answer to my challenge?
Thank you Ammar for very good video, and very simple explanation!
reply
One more excellent video from the factory or AMMAR'S LOGIC INDUSTRIES.
thank you ammar for a very nice riddle, not very hard, but very nice.
btw, what is the chance of this coin to cover only 1 white area, and 1 black area?
(I mean not, for example, on the cross middle of 4 squers, forming 2 white and 2 black areas, like the logo of BMW, and not near the corner, covering 2 black areas and 1 white)
What is the chance to cover ONLY 1 white and 1 black areas? That problem is turning the riddle from Amazon interview question, into NASA interview question.
Can you please, make part 2 to this video, which in you show the answer to my challenge?
Thank you Ammar for very good video, and very simple explanation!
reply
Erik
I got the solution a different way which was easier to calculate: To cover 2 colors the coin must be crossing a vertical vertex, a horizontal vertex, or both. Whether it's crossing a vertical or horizontal vertex are independent probabilities, if the coin is placed randomly. The coin can travel a distance of 1 while across a vertex, and a distance of 1 between vertexes, so the probability of it being on a vertex in 1 dimension is 50%. So the probability of being on neither vertex would be 50%-50%, which is 25%, so the probability of it being on at least one vertex and thus covering 2 colors is 1-25%, so 75%.
reply
I got the solution a different way which was easier to calculate: To cover 2 colors the coin must be crossing a vertical vertex, a horizontal vertex, or both. Whether it's crossing a vertical or horizontal vertex are independent probabilities, if the coin is placed randomly. The coin can travel a distance of 1 while across a vertex, and a distance of 1 between vertexes, so the probability of it being on a vertex in 1 dimension is 50%. So the probability of being on neither vertex would be 50%-50%, which is 25%, so the probability of it being on at least one vertex and thus covering 2 colors is 1-25%, so 75%.
reply
bluemalamute
How about this one? Imagine the universe is filled with alternating cubes of chocolate and vanilla ice cream with edge length 2. Suppose we can randomly extract a unit spherical scoop. What is the chance of getting only chocolate?
I'm figuring within a given flavor cube, there's a unit cube where the center point of the scoop can be and get only that flavor. So, to get only chocolate, you have. 5 [prevalence of chocolate] - (1/8) [volume of target cube/volume of flavor cube] = 1/16 chance of only chocolate.
reply
How about this one? Imagine the universe is filled with alternating cubes of chocolate and vanilla ice cream with edge length 2. Suppose we can randomly extract a unit spherical scoop. What is the chance of getting only chocolate?
I'm figuring within a given flavor cube, there's a unit cube where the center point of the scoop can be and get only that flavor. So, to get only chocolate, you have. 5 [prevalence of chocolate] - (1/8) [volume of target cube/volume of flavor cube] = 1/16 chance of only chocolate.
reply
tubular618
Extra credit: What if the coin diameter is 2? There is exactly one point in each square where the coin will be on one color only. Everywhere else the coin will be overlap at least 2 squares. If the area of a single point is zero, the calculated probability is 100% that the coin will overlap two colors, yet we know there is a non-zero probability that the coin will fall exactly in the center of a square. This appears to be a contradiction or paradox based on the assumption of infinite divisibility.
reply
Extra credit: What if the coin diameter is 2? There is exactly one point in each square where the coin will be on one color only. Everywhere else the coin will be overlap at least 2 squares. If the area of a single point is zero, the calculated probability is 100% that the coin will overlap two colors, yet we know there is a non-zero probability that the coin will fall exactly in the center of a square. This appears to be a contradiction or paradox based on the assumption of infinite divisibility.
reply
DavidS
All you have to do is to realize if the coin is totally inside a square, the center of the coin can be no closer than a half inch from the edge of any square. So a half inch on each edge it cannot be in. That leaves only an inch square in the middle of each square that it could be in and touch only one color.
So only one square inch out of the four total square inches of each square could it be in and touch only one color. So that means it's a 75% chance of it touching two colors.
reply
All you have to do is to realize if the coin is totally inside a square, the center of the coin can be no closer than a half inch from the edge of any square. So a half inch on each edge it cannot be in. That leaves only an inch square in the middle of each square that it could be in and touch only one color.
So only one square inch out of the four total square inches of each square could it be in and touch only one color. So that means it's a 75% chance of it touching two colors.
reply
Yngesh
Have one doubt, what if the squre's side is of length 1? then according to same formula shaded area = main square area - point = main sqaure area that means 100%. But we know that if coin lands on center of square it will not cover two colors and since board is infinite, there are infinite such points where coin can land. so what about the probability now? formula is giving 100% but we have cases where it covers only one color. --
reply
Have one doubt, what if the squre's side is of length 1? then according to same formula shaded area = main square area - point = main sqaure area that means 100%. But we know that if coin lands on center of square it will not cover two colors and since board is infinite, there are infinite such points where coin can land. so what about the probability now? formula is giving 100% but we have cases where it covers only one color. --
reply
Michal
The problem seems to be ill-posed. Nothing indicates that the coin's center should land on the central square. If we assume that it can land anywhere on the board, we get a completely different probability since squares around the seams have a smaller area adjacent to other squares. If I got this kind of interview question and the interviewer insisted that this is the correct solution I would be rightfully pissed.
reply
The problem seems to be ill-posed. Nothing indicates that the coin's center should land on the central square. If we assume that it can land anywhere on the board, we get a completely different probability since squares around the seams have a smaller area adjacent to other squares. If I got this kind of interview question and the interviewer insisted that this is the correct solution I would be rightfully pissed.
reply
Jouni
Check the effect of x and y positions of the coin independently. In both directions there's a repeated cycle of length 1+1, where the coin is over a (horizontal/vertical) line or between lines.
So the probability of being between lines in both directions is 1/2 - 1/2 = 1/4. The opposite is the coin being on a horizontal or vertical line, probability:
1 - 1/4 = 3/4.
reply
Check the effect of x and y positions of the coin independently. In both directions there's a repeated cycle of length 1+1, where the coin is over a (horizontal/vertical) line or between lines.
So the probability of being between lines in both directions is 1/2 - 1/2 = 1/4. The opposite is the coin being on a horizontal or vertical line, probability:
1 - 1/4 = 3/4.
reply
Alex
Let's just consider the square the center of the coin lands in. If the center of the coin is distance r (radius) or less from one of the edges, it'll overlap the adjacent squares. In this case, it's 0. 5 away. So there is a 1 by 1 square in the center of each 2 by 2 square thats safe for the coin center to land. 1-1/(2-2) gives the percent of safe area, or 25%
reply
Let's just consider the square the center of the coin lands in. If the center of the coin is distance r (radius) or less from one of the edges, it'll overlap the adjacent squares. In this case, it's 0. 5 away. So there is a 1 by 1 square in the center of each 2 by 2 square thats safe for the coin center to land. 1-1/(2-2) gives the percent of safe area, or 25%
reply
Jiten
Q- What would happen if the coin has a diameter of 2
A- We assume that the center of the coin is zero, but is actually the area of --the center, because the shortest length in physics is the length of the plank. For this reason an area of --the center of the coin will also be formed, but very little.
reply
Q- What would happen if the coin has a diameter of 2
A- We assume that the center of the coin is zero, but is actually the area of --the center, because the shortest length in physics is the length of the plank. For this reason an area of --the center of the coin will also be formed, but very little.
reply
David
0%. Black is not a color. Some people say white is not a color either (it is a shade. Also, the coin might stand on its edge so the true probability is not what you say it is. Also, I've never heard of 2 sided squares. Downvoted for giving the wrong answer and not setting up the rules clearly.
reply
0%. Black is not a color. Some people say white is not a color either (it is a shade. Also, the coin might stand on its edge so the true probability is not what you say it is. Also, I've never heard of 2 sided squares. Downvoted for giving the wrong answer and not setting up the rules clearly.
reply
Sidharth
There is a simpler way to see. The 2x2 square can accomodate the coin in 4 places evenly. Totally there are 16 chances of coin falling into either inside the color or on the line. So 4/16 = 25% is the chance it can fall in the color. Therefore (1-. 25) 75% on the line.
reply
There is a simpler way to see. The 2x2 square can accomodate the coin in 4 places evenly. Totally there are 16 chances of coin falling into either inside the color or on the line. So 4/16 = 25% is the chance it can fall in the color. Therefore (1-. 25) 75% on the line.
reply
rain
This is bothering me if someone can give enlightement, so if the coin falls in the lines between the shaded area and the non shaded area, it wont be able to hit 2 colors, in other words the probability of the coin hitting 2 colors should be less than 75% not equal to 75%?
reply
This is bothering me if someone can give enlightement, so if the coin falls in the lines between the shaded area and the non shaded area, it wont be able to hit 2 colors, in other words the probability of the coin hitting 2 colors should be less than 75% not equal to 75%?
reply
Vineeth
I have a puzzle for you
We have a tank of 50ltr and its filled with 50ltrs of water. Without using any object, only presence of you and tank, how can you remove exact half of tank ie is 25 ltr
This question is asked in my interview please can yoy solve this
reply
I have a puzzle for you
We have a tank of 50ltr and its filled with 50ltrs of water. Without using any object, only presence of you and tank, how can you remove exact half of tank ie is 25 ltr
This question is asked in my interview please can yoy solve this
reply
Jo
The riddle states it's an infinitely large chessboard. To be a chessboard, it must have 64 (8x8) squares. If it has more squares than that it is not a chessboard. So the 25% must be decreased by the probability of landing on an outside square, overhanging the edge.
reply
The riddle states it's an infinitely large chessboard. To be a chessboard, it must have 64 (8x8) squares. If it has more squares than that it is not a chessboard. So the 25% must be decreased by the probability of landing on an outside square, overhanging the edge.
reply
Dvorszky
Hey!
I used Inclusion-exclusion principle and got the same result. (P(A): probability of enclosing vertically, P(B): probability of enclosing horizontally. P(A)+P(B)-P(AB) = 0. 5+0. 5-0. 25 = 0. 75)
Is this a valid solution or was it just blind luck?
reply
Hey!
I used Inclusion-exclusion principle and got the same result. (P(A): probability of enclosing vertically, P(B): probability of enclosing horizontally. P(A)+P(B)-P(AB) = 0. 5+0. 5-0. 25 = 0. 75)
Is this a valid solution or was it just blind luck?
reply
Manas
So, we have four possibilities.
The coin can be completely in one square
The coin can enclose 2square
The coin can enclose 3squares
The coin can enclose 4squares
The last 3 cases are favorible. So 3/4
Isn't that also right?
reply
So, we have four possibilities.
The coin can be completely in one square
The coin can enclose 2square
The coin can enclose 3squares
The coin can enclose 4squares
The last 3 cases are favorible. So 3/4
Isn't that also right?
reply
Abhilash
What if I tell you that you don't need any math to solve this puzzle? In any chance, the coin can only cover areas from 4 squares at the most (75%) and 1 square at the least (25%. So chance of the coin enclosing two colours is 75%.
reply
What if I tell you that you don't need any math to solve this puzzle? In any chance, the coin can only cover areas from 4 squares at the most (75%) and 1 square at the least (25%. So chance of the coin enclosing two colours is 75%.
reply
Mandar
nice one. but there can be a corner case. the probability is valid for middle 6-6 = 36 squares but not for outermost squares. There, if we have to consider if coin can be on the outer edge or not. Based on which answer will change.
reply
nice one. but there can be a corner case. the probability is valid for middle 6-6 = 36 squares but not for outermost squares. There, if we have to consider if coin can be on the outer edge or not. Based on which answer will change.
reply
harsinchh
Meeting point Corner of 4 square if coin cover that point than it is one throw enclose 4 square in 1 throw.
1st can be is 1, 2nd can be 2 & 3rd can be 4, total in 3 throw best maximum enclosement will be 7 square.
reply
Meeting point Corner of 4 square if coin cover that point than it is one throw enclose 4 square in 1 throw.
1st can be is 1, 2nd can be 2 & 3rd can be 4, total in 3 throw best maximum enclosement will be 7 square.
reply
MagisterVeritas
The propability of the coin landing in a square is the area of the coin devided by the area of the square: pi/4pi which is 1/4 which is 25%. Anything else it means the coin lands outside and that is 75% chance
reply
The propability of the coin landing in a square is the area of the coin devided by the area of the square: pi/4pi which is 1/4 which is 25%. Anything else it means the coin lands outside and that is 75% chance
reply
Mina
I solved a little bit different,
I considered 4 squares, 2 blacks and 2 whites,
I needed to calculate the area around the axes, which was 12 over the total area 16, it gave me the same output as yours 3/4.
reply
I solved a little bit different,
I considered 4 squares, 2 blacks and 2 whites,
I needed to calculate the area around the axes, which was 12 over the total area 16, it gave me the same output as yours 3/4.
reply
Jack
Except that the perimeter of the outer squares allows for the coins that will fall along it to enclose just one color instead of falling into the square of another color. Therefore odds will be slightly decreased.
reply
Except that the perimeter of the outer squares allows for the coins that will fall along it to enclose just one color instead of falling into the square of another color. Therefore odds will be slightly decreased.
reply
Vasudev
Since the outer square is 2 and the inner layer is 1 and shaded also adds up to 1, if the shaded 1 is substracted from 4 then does the probability shift to 75% in favour of the other? Maybe the answer is 50%?
reply
Since the outer square is 2 and the inner layer is 1 and shaded also adds up to 1, if the shaded 1 is substracted from 4 then does the probability shift to 75% in favour of the other? Maybe the answer is 50%?
reply
kosprov69
Provided the entire coin lands completely within the board, the same logic for the centre square cannot be applied to the squares on the sides as the squares on the sides are bounded on 2 sides
reply
Provided the entire coin lands completely within the board, the same logic for the centre square cannot be applied to the squares on the sides as the squares on the sides are bounded on 2 sides
reply
Scott
The question should be rephrased, if the chessboard is infinite in size then the chance is of the coin landing on both colors is also infinite, because 75% of infinity is still infinity
reply
The question should be rephrased, if the chessboard is infinite in size then the chance is of the coin landing on both colors is also infinite, because 75% of infinity is still infinity
reply
Tony
I get this approach but there is a paradox on this kind of puzzles
Beacaus we dont calculated the probabilitie of the coins landing exactly on the sides of the small inside square!
reply
I get this approach but there is a paradox on this kind of puzzles
Beacaus we dont calculated the probabilitie of the coins landing exactly on the sides of the small inside square!
reply
R-bert
nope, it's ambiguous
the solution depends on HOW you throw randomly
which random distribution? (uniform was not stated and even if it was it doesn't exist on infinite domain)
reply
nope, it's ambiguous
the solution depends on HOW you throw randomly
which random distribution? (uniform was not stated and even if it was it doesn't exist on infinite domain)
reply
Add a review, comment
Other channel videos















