GOOGLE Interview Question || A Probability Puzzle || Hard Logic Puzzle

preview_player
Показать описание
GOOGLE technical interview puzzle : This puzzle is asked in the software or technical porgramming Google interviews. This video explains the questions or requirements and two different answers.
It's a hard logic riddle.
This interview puzzle has a mind blowing GOOGLE twist inside, so watch the complete video as you will see a smarter approach to solve this puzzle.
This Google interview question has got an intelligent answer that only a few people know.
PUZZLE :
A stick is broken at two random points. What is the probability the three pieces can form a triangle ?
Difficulty level : Hard

The points are randomly chosen independent of each other.
So it's possible that when you cut them at two random points, the pieces can form a triangle, but it's also possible they cannot not form a triangle.
So you've to find the probability that they form a triangle.
In this video, I will first explain a natural solution using the graph method.
And then I will explain a brilliant solution that can surprise even the interviewer, as very few people know about this solution.

Chapters:
00:00 Introduction
00:04 Google interview puzzle
01:03 Graph method solution
08:10 Out of the box answer

Google is known for asking tricky puzzles and hard riddles in the interviews. They check the optimization skills of a candidate with his approach of solving a puzzle. If a candidate has good optimization skills then it will benefit the organization in writing optimized programming code that eventually improves the response time of software applications and websites.
So if you are preparing for google interview questions for software engineer then you can watch all google puzzles on my channel.

Give a try to these challenging puzzles and riddles:

GOOGLE Interview Question || Puzzle : 12 Men On An Island || Hard Logic Puzzle

Seemingly IMPOSSIBLE Fox Puzzle || Fox in a Hole || Asked in Google Interview

Difficult Puzzle || 25 Horses Race || Asked in Google and Microsoft Interviews

3 Children Ages Puzzle || Can you solve this mind blowing puzzle ?

Torch and 8 Batteries Puzzle || Think outside the box

Ant & Honey Puzzle || Increase your logical thinking

5 Pirates PUZZLE (Version 2) | 100 Gold Coins 5 Pirates

Building & Rope PUZZLE || Think outside the box

Google Interview Puzzle | Poisonous Milk Bottle | Simple yet Tricky

Gold Chain Puzzle || Beautiful Logic Puzzle || 149 links

Is it possible to catch the Thief ? || Quick and Tricky Puzzle

Google Interview Riddle - 3 Friends Bike and Walk || Logic and Math Puzzle

GOOGLE Tricky Interview Riddle - 31 Dominoes on a Chessboard | Tricky Google question
Комментарии
Автор

Awesome Solution! 2nd one was Mind Blowing!🔥

geek_for_life
Автор

I think the reason is not enough to explain that the two situations are exactly the same in the Outside-of-the-box solution. Because we have to say about 'density' when we calculate the probability by calculating area. Although there is no problem, there are only a few explanations. if the length of h1 is fixed, the length of h2 and h3 can be anything between 0 and H-h1. If the length of h2 and h3 change, both illustrations' corresponding points will also change. In both illustrations, we can observe the possible locations of the corresponding point get bigger when the length of h1 gets smaller. It leads to the fact that the two situations have the same density.

The idea is very fresh and good to me. thanks

문재원-sc
Автор

Depending on the wording of the question exactly, a better "out of the box" answer is 100% as it does not state that you need to lay the pieces end to end. Simply content 2 pieces end to end and then slide the third along one piece to guarantee a triangle at some point.

It becomes the "Some months have 30 days, some have 31, how many have 28?" line of logic in that you are not expressly constraining the end points.

Thagrynor
Автор

Quite an advanced problem. Loved the solutions. More subscribers to you 👍

nocturnal_wanderer
Автор

That was awesome!
It would be amazing if you start a series of solving puzzles from books like "Puzzles to Puzzle You" by Shakuntala Devi or any other similar books.
Would honestly love consistency on this channel.

AbhayShan
Автор

Adding 2 points to different halves a line which are no more than half the length apart is what this problem boils down to. First point is 100 % becsuse it can be anywhere 2nd point has to be in the other half so thats 50% then for second point to be within half length of first is also 50% so.prob is 1x 1/2x 1/2

johnsmith-bbcl
Автор

Easy proof by complement: Let x and y be the two cut positions of a with length 1. Assume a triangle can NOT be made. Then one side must be longer than half the stick, that is 1/2.
1. case: First side too long. x > 1/2, y > 1/2. Probability 1/2 * 1/2 = 1/4.
2. case: Third side too long. x < 1/2, y < 1/2. Probability 1/2 * 1/2 = 1/4.
3. case: Middle side too long, that is either
3a) x-y > 1/2, or 3b) y-x > 1/2.
3a) x > 1/2 and y < x - 1/2. Here x is random between 1/2 and 1, such that on average we have y < 3/4 - 1/2 = 1/4. Probability 1/2 * 1/4 = 1/8.
3b) x < 1/2 and y > x + 1/2. Here x is random between 0 and 1/2, such that on average we have y > 1/4 + 1/2 = 3/4. Probability 1/2 * 1/4 = 1/8.
In total the probability a triangle can NOT be made is 1/4 + 1/4 +1/8 +1/8 = 3/4, such that the probability a triangle CAN be made is 1/4.

olerask
Автор

It was amazing!!
Both are mind blowing solution.

dollcyjain
Автор

I started studying the problem by assuming several points, equally spread along, where i can break the stick and determining number of cases the sticks can form a triangle. I started from 4 and went on to 6 and 8 points. Odd number doesnt work due to the fact that one point is in the middle and there is a lot of bordering cases (sum of two short lenghts is equal to the longest one).
I noticed that number of cases that can form a triangle (T) depends on the number of points (n). For case with n=4 (4 for half of stick, so 8 in total). For point 1 - 1 case. For point 2 - 2 options. For 3 - 3 opt. For 4 - 4 opt. I assumed it goes on. Total number of T is double of the sum (1+2+3+4) of these options. So for any number of points, it is double of sum of aritmetic row
T = 2*(n/2)*(n+1) = n*(n+1)
And number of all variants of the lenghts
V = V(2, 2n) = 2n!/(2n! - 2)
For high number of n the probability yields to 0, 25.

Jiri_Pijak
Автор

Yes, Bro, I feel after watching this the neuron circuits inside my brain (if any) has become a lot orderly.👍👍👍

dilipkumarsaikia
Автор

Man, this is brilliant. Maths has great magic power.

naimeshpatel
Автор

I just thought of how to place 2 points on a line. So since any side should be less than half of L, the point has to lie within one-half of the line, the probability of that is 1/2. Next, the other point should be placed such that the sum of the two pieces formed due to the two points should sum up to more than the 3rd side. The other point has to lie in the other half of the line, it cannot be on the same half as the 1st point was. The probability of it lying in the other half is 1/2. Therefore, the probability of forming a triangle becomes 1/2 * 1/2 = 1/4

adityachopra
Автор

Most Satisfying Solution of a tough Puzzle.
I don't usually hit the Like Button after watching, but this video Deserved getting it.👌👌👌

surya_bhaii
Автор

I have a solution in my mind. To form a triangle, sum of any two sides must be greater than the third. Consider we cut the pieces from left to right. So the first cut must be at the left of middle point(To satisfy the condition). For this probability of cutting at the left of middle point is 1/2. Then we are left with a piece having the middle point. Now the condition for the second cut is that it must not be on the left of the middle point to satisfy the condition. For this second cut the probability to cut at the right of the point is 1/2. Overall probability is 1/4. Is this approach correct? If this is not correct, then point the place I am wrong? Expecting your response!!

dhineshmsda
Автор

Try to make more such videos consistently. This video was amazing 👍

prajwalshivarkar
Автор

wow! good job (second solution), so easy yet so efficient.

tuncg
Автор

I loved it 😁
Also, it was very well explained. Very clearly explained. 👏👏👏 Thank you 😇

marcinbukowski
Автор

I learn so many things from your videos, very well explained and the animation used was superb sir 🙌👏👏

darshanms
Автор

Hello Ammar,
Just wondering can we do it by this method too?

1)

This is our line.


Place the first cut anywhere after the middle point {as if we make the other cut anywhere (with only 1 exemption case that is covered latter) before the first cut, we are sure that a triangle is going to be formed}
This makes the probability of consideration of the point : ½ on the line.

2)You can place the second cut anywhere in the line now.

*CASE -1: Place it anywhere before the first cut but make sure that it's in a way such that the first two piece doesn't extend l/2 length each*


The number of possible combinations will furthermore decreases the probability of the total event by ½.

*Case-2: Place the second after the first cut*



In this case the triangle is not going to be formed as one side would be greater than l/2.

*So the total probability becomes ½ × ½ = 1/4*

Anonymous-
Автор

a+b>c
a+b+c = 1
so c < 1/2 for all triangles, 1 can be substituted by any value
probability of c<1/2 is 50%
if c<1/2 than a or b must be max 1/2 with probability 50%
in total: 1/2*1/2=1/4 probability of a, b or c in any order forming a triangle

andrejgano