It's a war between space and time complexity. Earlier days memory was too costly but we had time, hence we had less space consuming but more time consuming apps. But now space is cheap but time is costly, that's why we are having more space consuming and less time consuming apps. Dynamic Programming literally means using more space to reduce the time required for computation. So it's simple, the first approach takes more time but less space, and the second approach takes more space but less time. The solution depends relative to the problem always which is why we don't have 1 definite solution for all. Both the approaches are correct and you would get a job if you are able to explain it.
Murali... that was a valuable suggestion/thought to understand that the present era has changed a lot, and now everything is about time (responsive design).
I wonder if you could get away with O(n) space with this algorithm. The original algorithm still needs O(n) space, because that's the only way to compare weights in this scenario. Here, the naive approach is to load in all weight mappings in advance for O(cubedroot(n)*n) space. But if you could somehow determine the final #/h/l mapping without having to back-reference the list and count L/R/= signs, then it's pretty trivial to switch to O(n) space by loading in one weighing at a time.
For the 1st riddle cant u split the group in half (6 on each side) then let the men get off in pairs (1from each side) until its is balanced then u will know which pair was uneven and have 2 suspects. Now balance 1 of the suspects against any of the other 10 we know r normal weight and if he is same weight then with ur last attempt at balance him against any of the remaining eleven to tell if he is lighter or heavier if suspect 1 was uneven u would have observed if he is lighter or heavier and still had 1 attempt remaining
@@danielbinns2802 No, because each time you remove a pair, you are weighing a different combination which means it counts towards the 3 times you can weigh a combination.
@@alidhan1299 the riddle said u can only use the seesaw 3 times it did not say that u can only weigh different combinations 3 times and if they get on the seesaw they have to come off it. I'm just giving them a specific order to come off instead of having them all come off at once. Same can be done for the order they go on the seesaw because they can all simultaneously go on so I would observe the weights while they go on or get off. This is my way of thinking outside the box
The question looks like it was written by a 12 year old that just finished their first semester of programming electives. If you want a search/sort algorithm ask me for a search sort algorithm--don't make up some retarded scenario that would never ever happen and pretend that there aren't hundreds of ways to solve it without a search sort algorithm. To put it clearly--no one in their right mind would solve this problem in the real world the way google is expecting you to solve it. It's just stupid.
I puzzled over and gave up. The first solution is so amazing how it saves every bit of useful information from each step to combine later to reach a result quickly. The second solution washes all that away and looks at the general problem, showing how it all just falls together naturally and without anything special. The richness of the solutions to such a simple problem are what brings me back to mathematics every time. So much hidden wonder. Even though I didn't solve it myself I found this inspiring.
We had this question back in winter term 1989 on our very first weekly exercise sheet at the very beginning of our Computer Sciences studies, at Karlsruhe University, Germany. We did come up with solutions similar to this one, but the real catch came when we were shown and told that this can be modelled as an error-correcting Hamming code with a 12x3 matrix over Galois Field GF(3). One matrix multiplication and bang, you get the position and weight of the odd man out. Oh, that was an ideal precursor to the advanced stuff that was to follow in the next couple of years, and a sure way to whet our appetite. Happy memories.
I remember my uncle, a physics teacher, gave me this question when I was 12, it took me a few hours to solve it. I still remember I intuitively went for dividing them into 3 groups right away (anything else felt useless in terms of revealing the maximum amount of information). Fir the last/third weighing, I didn't know any better than brute forcing. I was so fascinated that later I proved a formula for the generic case of N men for the minimum number of weighings required. Back then with no internet, this kept me busy for a few weeks.
I solved this puzzle in other way around 12 yrs back.. W-weigh, we give number to each on Scenario 1, W1: four on each side 1234-5678 if it is balanced then it is simple to find the odd one from remaining 4, as follows W2: keep a person(12) aside n weigh like this 9,10-11, 1, if it is balanced then compare 12 with 1, ll know whether he is lighter n heavier. If it isn't balnced, and tilting towards 9,10 means either one of them is heavier r 11 is lighter, then W3:compare 9&10, which way it goes is the heavier one, if balanced 11 is lighter. Scenarios 2: W1: 1,2,3,4 - 5,6, 7,8 unbalanced n shifted towards 1234, W2: 1,2,5 - 3,6,9 if still shift to 1,2,5 it means either one from 1&2 is heavier r 6 is lighter.. Then compare 1&2 which side it tilts is the heavier if balanced 6 is lighter. If 1,2,5- 3,6,9 is balanced means eeither 4 is heavier r one from 7&8 is lighter, then compare 7 with 8. if in Scenario 2 balance shifted to 3,6,9 side that means either 3 is heavier r 5 is lighter... Compare any one from 3&5 with normal one to get to know the odd one...
Ramesh Kiran's solution (almost same as mine) seems to be the best solution, so I've written it up below in clearer terms ("W#n" means the nth weighing): W#1: Weigh 1,2,3,4 vs. 5,6,7,8. If W#1 is balanced (odd one is 9,10,11,12), then: W#2: Weigh 9,10 vs. 11,1. A. If balanced, then W#3: weigh 12 vs. 1 to see whether 12 is light or heavy. B. If unbalanced, then W#3: weigh 9 vs. 10; if W#2 had 9,10 heavier, then whichever side is heavier in W#3 is the heavy one (or if W#3 balanced, 11 is light); or if W#2 had 9,10 lighter, then whichever side is lighter in W#3 is the light one (or if W#3 balanced, 11 is heavy). -------------- If W#1 has 1,2,3,4 heavier: W#2: Weigh 1,2,5 vs. 3,6,9: A. If 1,2,5 heavier (1 heavy or 2 heavy or 6 light), then W#3: weigh 1 vs. 2; whichever side is heavier is the heavy one (or if balanced, 6 is light). B. If 3,6,9 heavier (3 heavy or 5 light), then W#3: weigh 3 vs. 12 to see whether 3 heavy (if balanced, then 5 is light). C. If W#2 balanced (4 heavy or 7 light or 8 light), then W#3: weigh 7 vs. 8; whichever side is lighter is the light one (or if balanced, 4 is heavy). -------------- If W#1 has 1,2,3,4 lighter, then the process is same as above, switching corresponding numbers.
@@qc1okay Y these many scenarios , It's simple 11 are having equal weight 1 guy is over weight 3 times we have to use that sea saw 1) first divide the 12 members into 2 grps 6-6 weight them one side shall be heavier. 2)take the heavier grp ie 6 ....now divide them again into 3-3 as grps and again weigh them .you will get the heavier grpWho are only 3 3) Now of those 3 members tell two members to be on seasaw ..... If they weight equal ....then the 3 Rd guy is the different one . And if any one of those 2 are weighing heavier ......he is the guy as other all 11 members are of equal weight.
Not at google but I was asked this question years ago for a server lab job. I did not know the answer and did not get the job lol. He said not one interviewee knew the answer. I still believe to this day if I knew this riddle I would have gotten that job.
Epik using a stick would not yield accurate results and also the compression of sand particles could result in the elasticity of the the sand as a whole
I watch the first minute of this video and then I paused it. I realized that I was presented with this puzzle in 1989. However it was presented to us as 12 balls and a balance scale that could only be used three times. The professor wanted us to come up with the best route that will result in the highest potential of coming up with a solution. I came up with a solution the next day. When I presented it to him he said that I must have made a mistake. The reason was; when he was presented with the puzzle, it was presented to them as something that does not have solution. I'm glad that he had forgotten to tell us that little detail.
for the first few minutes, "Ahh I got this, simply do it as TedEd has explained". the second explanation, "Ohh wait, what was that? how could you... but... nevermind."
But i believe, even the first approach is not easy.. if compared with TedEd... because in their version of puzzle we don't have to figure out the DEFECT (if the object is heavier or lighter).
@@LOGICALLYYOURS In this problem there is a trick that is "lever" thats why I would just say it cannot be solved. Cuz as you can imagine at seesaw the nearest man close to the middle, will be the lightest. But its true just for this question.
@@grayfurt95 Even if you factor in the lever, that implies that the force of a person's weight is relative to their position on the scale, as long as people or objects being weighed are evenly distributed along the scale on the scale and both sides have the same number of people, the problem is still solvable. If all people on the scale weigh the same, it will balance. If a single lighter or heavier person is on the scale, it will be uneven regardless of the outlier's position as there will be a difference in the total amount of downward force between the two sides of the scale.
This is based on a problem from a brazilian math professor Júlio César de Mello e Souza. during the 1930 decade. My father was one of his students and told that he was a wornderfull mathematician. I'd lije to suggest that the Google give credit to him. He wrote a book called "O homem que calculava" Something like "The man that used to do calculus"
Just found this: my father gave me this one when I was a young teenager. His only clue was "you must get the maximum amount of information from each weighing". When I couldn't do it, he amended this to "what does each weighing tell you?". I did it - in the end. Later on I did programming and got to know about the "even more logical" approach mapped out here.
I think in general you should balance the following three quantities as good as possible in every step (while making sure Left and Right contain the same number of people by filling up with Confirmed Persons): A) 2 * Unknowns Outside + Suspects Outside B) Unknowns Inside + Heavy Suspects Left + Light Suspects Right C) Unknowns Inside + Light Suspects Left + Heavy Suspects Right If not perfectly possible you should prefer to have the Inside a bit larger. Reasoning: This optimizes the worst possible outcome of the scaling step.
My first solution had a slight difference: in the second weighting, on both sides I put two suspects to be heavy and one suspect to be light. This removes case 2b and adds an additional case 2c.
It's definitely older than that. The first time I heard this puzzle was from my uncle when I was a kid. It was years before the release of the show. Now I wonder about the origins of this puzzle.
I don't know if this is right but I did pause at the beginning of the video. Here's how I would solve it. Put 6 men on each side. The side with the odd weight will be highlighted. For the 2nd time put in 3 men on each side and again the odd will show up leaving 3 men. Now on the last time I could use the seesaw, I am gonna put 1 on each side. If it tilts then there goes the odd one. If it's balanced then it's the one standing. 👌🏻
How do you know which side has the odd weight? If the seesaw tilts right, it could either mean there’s a heavy man on the right side or a light man on the left
I did group of 4 vs 4. Then shift out 3 pleople from the left and shift in three to the right. Weigh again. By tracking which way scale tilts you can tell which group of three has lighter/hevier person. If last guy is left alone just weigh him against anyone else. .
Actually, the 2nd "solution" is a great example of poor optimization - that is, optimizing the WRONG THING. The 2nd solution only works better on an ideal machine - one which has no performance limits based on data set size, and no memory performance limits. Such machines, of course, don't exist in the Real World, and thus, the optimization done in the 2nd solution will perform significantly worse than a solution that uses the 1st solution as it's base algorithm, but which is tuned to understand how limits of hardware affect actual computation.
@@eriktrimble8784 for optimization, both explanations in the video are wrong. Elimination by consistent half is always mathematically the fastest procedure for narrowing. and also finds the Odd man in three steps in this situation. this approach would not always tell the weight of the odd man. but it would be more proficient to weight the odd man at the end instead of considering the weight of everyone during the process.
The big problem that threw me off track when I first was confronted with this problem in the late 90s is the amount of if/then/else branching you have to do. And if you know the 9 ball / 1 heavier problem, it actually makes it harder for you to solve this since you start off trying to solve it the same way, which does not work.
The solutions presented are quite impressive. My personal solution involved some lateral thinking: 1. Take half of the 12 men randomly, and weigh them against each other (3 vs 3). If the seesaw is balanced, we know the other half of the men contains the suspect, otherwise he is in the half that was weighed. So now we have identified the suspect group, and the even group, each with half of all the men. 2. Take the even group and put them all on one side of the seesaw, and the suspect group on the other side. The seesaw will be unbalanced slightly, and now we will know whether the suspect is lighter or heavier . 3. With all the men still on the seesaw, instead of having everyone get off at once, have just 1 man from each side get off at the same time, and continue the disembarkation in this manner. When the seesaw becomes balanced, pause to acknowledge that the last man who got off the seesaw from the suspect side is the one with the odd weight, unless it is the last man from the suspect group in which case it will remain unbalanced when there is one man left from each side. This technically only uses the seesaw twice, and can be scaled up to any number of men assuming the seesaw is big enough to support them all. The method of each side taking it turns to let a man off makes sense too because the first man to get off will make the other side heavier and sink closer to the ground, making it easier for them to leave.
That is why a computer programming definition is more precise. You can call a function measure(men_left_side, men_right_side) which gives you the output L, R, =, and you can only call it 3 times. No ambiguity.
I created the same puzzle to challenge myself when I was a high school student back to 50 years ago. 12 coins with one fake without knowing it is heavier or lighter, the measurement tool is a balance scale. The solution I found was divided them into 3 groups, 4 each. 1,2,3,4 5,6,7,8 and, 9,10 ,11,12. The first measurement is to place 1,2,3,4 on left side and 5,6,7,8 on right side. If it is balanced, 9,10,11,12 has one fake coin, it's easy to find it with 2 measurements. If it is not balanced, then the tricky part is to do a rotation. Left side to be 1,6,7,8 right side to be 5,10,11,12. Then you'll find 2,3,4 or 6,7,8 or 1,5 has a fake coin in it. You can easily find it with 3rd measurement. Then I ask myself what is the maximum coin I can inspect with 4 measurements? How about 5 and more? Then I found the answer is 12*3^(n-3). I read most of the comments, I like the one solution to use 3x3 grid.
I remember reading a solution in verse to the 12 coin problem in the early 1970s, possibly by H E Dudeney: "F" set the coins out in a row And chalked on each a letter, so To form the words: F AM NOT LICKED (An idea in his brain had clicked) And now his mother he'll enjoin: MA, DO / LIKE ME TO / FIND FAKE / COIN !
My solution to the problem was to divide all the 12 men into two groups and put them on either sides of the see saw, obviously it will be imbalanced. Then we ask one person from each side to step down together and when the see saw becomes balanced this way, we select the pair which stepped down at last. The suspect is one of them. Then we can weigh the two of them one by one with a safe person to know who it is and if he is lighter or heavier.
12 men into 2 groups 6-6. One side will be unbalanced Take everyone off the see saw. Take the 6 from the unbalanced side and split em 3-3. One side will be unbalanced. Take everyone off. Take the 3 left, put 2 on the seasaw. If it's equal then the one not on the sea saw is the odd man. If it's not equal then you've found your odd man.
Took me around 30 seconds. Put 4 on each side and leave 4 out. If the scale tips remove the 4 left out and the high side. If it balances remove those 8. Then take the 4 that were on the low side or the 4 that were not on the scale. Place those 4 men on the scale, 2 on each end. Remove the two from the high side. That’s the second scale move. Then take the remaining two men and put them on the scale. The heavy guy drops the scale to his side. That’s the third scale move. I then watched the video and the explanation. His explanation had me shaking my head
The solution i came up with : Just devide them into 2 equal groups and place them on the seesaw Then let them jump down one by one , 1 man from each side at the same time When the pair with oddman jumps down the seasaw will be balanced Then we know one of them is heavier or lighter For the 2nd time Just weigh one of them with a normal man If he is the oddman we will know And if the seesaw balances then the other man is odd And we just have to weigh him with a normal to know if he is heavier or lighter
every time you let people jump off the seesaw you are essentially weighing the remaining people, counting against the three weightings that are allowed.
Took the one who gave me the puzzle 20 years ago 2 weeks to solve it. I did it in 2 days. Didn't make me very popular with him. I guess there are people who, without being trained in such logical structures, just take a few seconds.
Thank you very much sir for sharing such a important and valuable problem with solution and all your videos helped me a lot in improving my knowledge and I am now able to ace many of the aptitude test and I am really thankful to you a lot sir and plz keep posting videos. I am your big fan sir
My solution. Put half men on each side. It will either R or L. Now, each side put a man down so they come down in pair. See when the seesaw become balance. The last pair is the one having odd man. Weigh one of them with one normal man. You got your answer dude. Even with 100 men you only need 2 weighing.
This problem was the climax of _With a Tangled Skein_ by Piers Anthony. The solution given was the same if the first weighing balanced, but it had an interesting concept for when the scale was unbalanced. Suppose at first weighing, you have: W1: H1 H2 H3 H4 vs L1 L2 L3 L4 Meaning the side with Hs is heavier and the side with Ls is lighter. Then proceed as follows: W2: H1 L1 L2 L3 vs N1 N2 N3 L4 If this balances, the odd one is one of H2, H3, or H4. Weigh: W3: H2 vs H3 If this balances, the odd one is H4. If this does not balance, then the odd one is the heavier one of H2 and H3. But if W2: H1 L1 L2 L3 vs N1 N2 N3 L4 does not balance, there are two scenarios: If the H1 L1 L2 L3 side is still heavier, then the odd one is either H1 or L4. Weigh: W3: H1 vs N1 If this balances, then the odd one is L4. If this does not balance, then the odd one is H1 If the H1 L1 L2 L3 side is now lighter, then the odd one is one of L1, L2, or L3 Weigh: W3: L1 vs L2 If this balances, then the odd one is L3. If this does not balance, then the odd one is the lighter of L1 and L2.
My version with coloured hats (all hats have equal weight) Strategy behind this is, roughly, that you have 1/3 of non-greens off-scale, 1/3 of them staying on their side and 1/3 of them switching side. If the scale balances the odd one is off the scale, if the scale switches the odd one is in the group that switched and if the scale stays the odd one is in the group that stayed. 1. Everyone gets a white hat (white like blank paper) 2. Whenever the scale is balanced, everyone on it trades their hat for a green one (green like all good, not the odd one out) 3. Whenever the scale is imbalanced, everyone NOT on the scale gets a green hat (because the odd one out must be on the scale) 4. On the "lighter" side, if any, white hats are traded for blue hats (blue like air) and black hats (black like ground) are traded for green hats. 5. On the "heavier side", if any, white hats are traded for black hats and blue hats are traded for green hats 6. Start by weighing 4 vs. 4. You get 8green/4white or 4blue/4black/4green. 7. Continue weighing 3 white vs. 3 green or 3blue+1black vs. 3green+1blue 8. You now have 1 white or 3 blue or 3 black or 1 of each blue and black, all the others are green (this is a bit tedious to check, but straightforward). 9. weigh 1 blue vs. 1 blue or 1 black vs. 1 black, if possible. If not you weigh a non-green vs. a green. 10. You now have 11 greens and a blue or a black (even more tedious to verify, sorry).
I came up with a totally diferent approach. If the defenition of using the scale is to put objects on it to see the result I would: 1, Place everyone on the midle and ask one person on each side to walk to the end. The scale will be balanced until we find the odd one. then we have two candidates. 2, Compare the first candidate to the control group in the midle. 3, Compare the second one to the control group if needed.
The biggest problem of this interview question is that it does not tell you anything about the quality of the candidate, no matter if his answer is right or not. That is why Google failed in more projects then he successfully finished 🙂
Actually this type of question does help know more bout a person. It helps Google know whether the person is a creative, quick or logical thinker. By answering the question in a creative way, maybe google would want to hire them, for creative solutions to problems. If they can answer the question quickly, then that person is great for quick responses to problems. And if they are logical in there answer then, there’s a great chance that the person makes smart decisions. Also if the person maybe takes longer to answer, they may be the type of person to make an informed choice to a decision. All these types of answering a simple question could really show how the person thinks when asked a spontaneous question. Although I do agree that only 1 question does not determine how the person actually makes decisions or choices, it gives a good gist on how the person thinks in an interview setting, with the stress. 🙂
Literally any question can at least lead to inference of something qualitative. You have no clue what position the person is applying for or what qualities that are looking for, just made an empty negative claim.
@@TheJacklikesvideos During my carrer, I have interviewed dozens of people and yet I am far from to be an expert but I have at least SOME experience. May I ask you what real experience you have?
This would have taken me about 25 million factorial years to solve the way you did! The brute force approach however is very simple and easy to implement, and takes less than a second even for large sets.
I hear you David! I knew there was a perspective to approach from, I kinda created my own math language to write out the hypothetical situations. Once you really understand the rules, it seems super simple. At first I wanted to be creative with unequal numbers of men/not even using the seesaw. But even after trial and error, I think anyone can slowly learn how this puzzle works. Glad you figured it out! I usually feel like I can’t solve some problems, but yes very satisfying!
So simple first divide 6-6 then weigh them then take odd one side on account then divide them 3-3 then take odd again and then chose randomly two of them and eliminate the the odd one
So ... First of all, this was an eye opening exercise, but now I'd like to ask a few questions, and I hope someone can answer them: 1. We discard 2 combinations at 15:52, does it mean that we could technically solve this for 14 people? 2. 17:30. Must we choose from each section or can it be, for example, both from orange section? 3. If we had an odd number of people (say, 9 or 11), would this table approach work? 4. Which books would one suggest to read about this subject.
Generally, if you're scaling this for large numbers, you can weigh ⅓ vs ⅓ of remaining candidates each time. The first time the scale is uneven just weigh one side vs. standard weights and you've solved for heavier or lighter and simplified the problem to paring your candidates down to ⅓ previous with each weighing with no need to sort or label them.
You can't even solve this for 13 people, even though it seems like those 26 different possibilities would just fit within the 27 possible results of 3 weightings. The reason is that you always must have an even number of people on the scales to measure balance. If you weigh 8 at the first weighting and it evens out, then one of the 5 remaining is the odd one out - 10 possible combinations with just 2 weightings to go. Yet if you weigh 10, and the scale tips, then there are 5 that could be heavy and 5 that could be light, also 10 possibilities. 13 is just too much for 3 weightings.
Here is a simpler algorithm for the general case: For each step, balance the Positions in such a way that 2 * Unknowns + 1 * Suspects is the same no matter what the scale does. (If not perfectly possible, place the remainder ON the scale.) This does not account for cases where there are not enough Confirmed Persons to make sure both sides of the scale have the same number of persons.
@@guitaek4100 Ofc not. Thats why youll never have a riddle on a job interview. It doesnt provide any info about the candidate. Its pointless. Talking as a Psychologist.
@@svilenacarapica4491 Interesting. In my job interview I had a riddle (not google) I didn't found the solution my own however I found an own (not as good as) solution. I guess it should test you wether you're creative. So why do you think it's pointless?
2nd way is take 11 mens first one in COM of see saw and 5 on left 5 on right then If one of them weighs more take those 5 mens (also as we know the middle one is not the odd men so we discard that man) and 2nd time make them sit 2 on left and 2 on right one on the middle and If this time also the more wighted 2 mens left take the COM one out take these 2 mens out. Then in last attempt you will get to know that who is more in weight definitely cuz this time only 2 mens are left and also the man which was left at first would not be the man with odd weight cuz if he was then there would be case 1 which I answered in the comment already Hope it helps 👍👍
You need to identify whether the defective object is lighter or heavier.... that makes it difficult.... whereas in ted-ed version you don't have to find out the defect.
There is an alternative way describing the 2nd method: Again, we use the seesaw independently. Instead of encoding on the results, we encode the men. We have total 3 times to use the seesaw. So, a man is encoded as X = (X₁, X₂, X₃), where Xₖ can be R, L, 0, and Xₖ = R (L) means this man appears on the right (left) side of the seesaw for the k-th turn, and Xₖ = 0 means the men does not appear on the seesaw for the k-th turn, k = 1, 2, 3. Now, the rule of encoding: 0. Of course, each man must have a distinct encoding. 1. Each turn, the number of men on the right and left sides must be equal, i.e. the number of R assigned to Xₖ must be the same as the number of L assigned to Xₖ, for all k = 1, 2, 3 2. Each man must appear at least once on the seesaw, so you can not encode (0, 0, 0) to a man. (because even though we find everyone else having equal weights, we cannot make sure this odd man to be heavier or lighter: he never went on the seesaw!) 3. If an encoding is assigned to a men, the inverse encoding (R L, e.g. X=(R, 0, R) vs X=(L, 0, L)) will be dropped (cannot be assigned to another man), otherwise since the two men always take the opposite positions, if one of the two men is the odd man, we cannot distinguish them (the results would be either A is lighter of B is heavier, but we cannot make sure which man of the two is odd). Similar to the arguments in the video, it's obvious that we need to drop (0, 0, 0), (L, L, L), and (R, R, R) to make number of R's and L's balanced. Similarly, we have 27-3 = 24 combinations, and by Rule #3, we only use half of them, and drop all the inverse encodes: So we use only 12 combinations, and assigned to 12 men. We further define the 3 results Y = (Y₁, Y₂, Y₃), where Yₖ can be 'R', 'L', or '='. Yₖ = 'R'('L') means the seesaw resulting in Right (Left) side heavier, while Yₖ = '=' means the seesaw balances, at the k-th turn. After we assigned the men's encoding, it's obvious, for example, if the results of the three times are Y = (L, R, =), it must be some men encoded either X=(L, R, 0) or X=(R, L, 0) to be the odd man. In this case, If we found a men is encoded as (L, R, 0) , we can also confirm this man is heavier (because the man stayed each time on the heavier side), while if we found men is encoded as (R, L, 0), we can confirm that man is lighter.
This puzzle features prominently in the climax of Piers Anthony's book "With a Tangled Skein", which I read about thirty years ago. The protagonist had made a bet with Satan and was weighing demons. Obviously the puzzle was a memorable one, since I still remember it!
It is a variation of the "fake coin" problem that we were solving in a high school. Our nice solution puts the people in a grid 3x3 with the extra 3 diagonally. Then you weigh two columns against each other and depending on a result you pick two rows to weigh against each other. When you look at it you'll see the solution right away without a need for any spreadsheets. Still nice though.
On the first minute of watching this video answer just poped up in my mind We Can devide 12/2 so 6 on each side in the first round we'll knockout 6 lighter ones Than on second round we'll test heavier 6 by doing 6/2 = 3 on each sides Again we'll take heavier 3 and now on the last round we'll Put any two there if it's still balance that means the remaining one is heavier else if seasaw worked so heavier one will be down
A seesaw does not compare weights. It compares torque. It will balance = only if torque is same on both sides and that's highly unlikely as men will not be at exactly the same distances from the center. The puzzle makes much more sense (cents?) with coins on a balance scale where the weight is concentrated at the pan's suspension point.
Before watching, my first guess is to just put 8 people on the seesaw, four on each side. If they’re all equal, then you’ve refined it down to the other four. Either way, you end up comparing only two men on the third time around.. I think
All 12 on the seesaw, 6 on each side. Then have one from each side step off. Repeat until there's a change. Once the change is found have all step off and the two that caused the change to get on one side with two others on the other side. Have one from each side step off. Change? Then the one that stepped off on the affected side is guilty. No change? The other is. I've used the seesaw twice. To use the seesaw you have to load it and then unload it. The load/unload process happened two times.
Whilst the maths is very impressive, I would be asking...1/How do you know one man weighs diferently before the exercise starts if they haven't alteady been weighed? 2/Why can we only weigh three times? 3/Why do we need to know who has a different weight? 4/What are the men doing on the island?Knowing why you are doing something/the purpose of the data is also important. Logic. X
Nice Explanation. Just a bit of correction though. Last part (3^x-3) that you wrote by the justifying -3 as 1 for === and 2 for equalling L and R. That should be (3^x - 2*no. of men). Because you see for 12 men it eventually turned out to be 27-24=3 (Making extra 3 possibilities so -3) but for 100 men it will be 243-200=43 extra possibilities. Love your videos. Thank you.
he said to remove at least 3 rows which means greater or equal (43>3) so no need for a correction . if you try this with just 13 people you'll need to discard 3^4-26 = 55 possibilities since 3^3-3 < 13*2
Just to add on this, coding this is actually very trivial, because if you assign L=0, (=) = 1, R = 2 than the numbering of the people will match the weighting scheme if you look at the numbers in base 3
I have another answer for 1st question Seperate into 2 batches 6 and 6 balance them once 1 batch will either weight more or less then again seperate the weight variation into 2 batches 3 and 3 one batch will varry and balance the 2 guys while 1 guy waiting if they both weights same then the remaining person is diff weight
Wouldn't that indicate pressure though, not weight? They would have to have exactly the same size feet and the sand be perfectly the same density across the beach.
Ah, there's always that smartass who thinks he's thinking outside the box. It's a riddle that specifically asks you to use the seesaw, its not asking you to find the differemt weight using any means possible. Otherwise just ask the men about their weight lol.
I found a diffrent way: It has to do with the fact that the distance from the center matters. Ex if the odd man is near the end the saw's change will be more dramatic. Using this approuch we can split the men in half and find two possible candidates. Weight each candidate with a normal man and boom it works. It also works with any amount of men.
But you don’t know how much more or less the odd man weighs. If someone slightly lighter than the rest would stand near the end, wouldn’t the change be less dramatic compared to if someone much, much heavier stood closer to the center? We wouldn’t know the difference in weight and therefor this approach could fail to find the odd man.
The correct answer is to say, "Excuse me... This question is fat-phobic and I want to talk to your manager." That's how you get a woke job at a woke company.
I use only two time, first time 6-6. One side wight is large, Split the large 3-3. 3-3 using seesaw. There are equal the odd one is lighter to others, 3-3 are not eqal the odd one is heavier.
@@stefanpodgorsek7687 What if my problem solving skills are average but I binged watched all the Ted-Ed puzzle/riddle videos, and just happened to see the one about finding the counterfeit coin in a pile of 12 coins using a scale?
3 friends A B and C,C knows how much time A and B individually watched Titanic movie.C said, between a and b, one of them watched the movie 1time more... A said B= video watched one time more than me? B replied- No,Did You? A said- No,but i got it, how much time you watched Titanic movie. B said,- O really? Then I also know how much time you watched Titanic movie... Question is how much times A and B watched Titanic movie?
I like more version where there are 13 men. All rules are the same, but you need to find which one is diffeerent weight. You dont have to tell if he is heavier or lighter. Good luck with that.
It's a war between space and time complexity. Earlier days memory was too costly but we had time, hence we had less space consuming but more time consuming apps. But now space is cheap but time is costly, that's why we are having more space consuming and less time consuming apps. Dynamic Programming literally means using more space to reduce the time required for computation.
So it's simple, the first approach takes more time but less space, and the second approach takes more space but less time. The solution depends relative to the problem always which is why we don't have 1 definite solution for all.
Both the approaches are correct and you would get a job if you are able to explain it.
Murali... that was a valuable suggestion/thought to understand that the present era has changed a lot, and now everything is about time (responsive design).
I wonder if you could get away with O(n) space with this algorithm. The original algorithm still needs O(n) space, because that's the only way to compare weights in this scenario. Here, the naive approach is to load in all weight mappings in advance for O(cubedroot(n)*n) space. But if you could somehow determine the final #/h/l mapping without having to back-reference the list and count L/R/= signs, then it's pretty trivial to switch to O(n) space by loading in one weighing at a time.
For the 1st riddle cant u split the group in half (6 on each side) then let the men get off in pairs (1from each side) until its is balanced then u will know which pair was uneven and have 2 suspects. Now balance 1 of the suspects against any of the other 10 we know r normal weight and if he is same weight then with ur last attempt at balance him against any of the remaining eleven to tell if he is lighter or heavier if suspect 1 was uneven u would have observed if he is lighter or heavier and still had 1 attempt remaining
@@danielbinns2802 No, because each time you remove a pair, you are weighing a different combination which means it counts towards the 3 times you can weigh a combination.
@@alidhan1299 the riddle said u can only use the seesaw 3 times it did not say that u can only weigh different combinations 3 times and if they get on the seesaw they have to come off it. I'm just giving them a specific order to come off instead of having them all come off at once. Same can be done for the order they go on the seesaw because they can all simultaneously go on so I would observe the weights while they go on or get off. This is my way of thinking outside the box
If we weren’t all so awkward we could simply ask the people their weights, thus eliminating the need for a seesaw
@Panso Pe ink gir gai Having extra or less weight doesn't make you an imposter.
@Panso Pe ink gir gai Don't forget ,they are man, and man don't get shy telling their weight
That is only fair if the imposter cannot lie or he turns into a chicken.
Imagine the question was about coins. You can't ask a coin for its weight.
@@OskaIvanovichSmirnov but the question isn't about coins, why would we need to imagine a completely different scenario
Like always, while credit is given to those who solved the question, I always admired those who came up with these questions in the first place....
Well, those who came up with the questions in the first place are the first to solve them I guess🤔
The question looks like it was written by a 12 year old that just finished their first semester of programming electives.
If you want a search/sort algorithm ask me for a search sort algorithm--don't make up some retarded scenario that would never ever happen and pretend that there aren't hundreds of ways to solve it without a search sort algorithm.
To put it clearly--no one in their right mind would solve this problem in the real world the way google is expecting you to solve it. It's just stupid.
I puzzled over and gave up. The first solution is so amazing how it saves every bit of useful information from each step to combine later to reach a result quickly. The second solution washes all that away and looks at the general problem, showing how it all just falls together naturally and without anything special. The richness of the solutions to such a simple problem are what brings me back to mathematics every time. So much hidden wonder. Even though I didn't solve it myself I found this inspiring.
My answer: Google search which man is heavier or lighter since all of their data is online
😂
Searching answer in Google to get job at Google😂😂
You don't get any info abt 12 men on a deserted island. That's sad
🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣
@@kaimadamantonyshejin2034 You need to know how your company works before joining it.
(Works has dual meaning here)
We had this question back in winter term 1989 on our very first weekly exercise sheet at the very beginning of our Computer Sciences studies, at Karlsruhe University, Germany. We did come up with solutions similar to this one, but the real catch came when we were shown and told that this can be modelled as an error-correcting Hamming code with a 12x3 matrix over Galois Field GF(3). One matrix multiplication and bang, you get the position and weight of the odd man out. Oh, that was an ideal precursor to the advanced stuff that was to follow in the next couple of years, and a sure way to whet our appetite. Happy memories.
I remember my uncle, a physics teacher, gave me this question when I was 12, it took me a few hours to solve it. I still remember I intuitively went for dividing them into 3 groups right away (anything else felt useless in terms of revealing the maximum amount of information). Fir the last/third weighing, I didn't know any better than brute forcing. I was so fascinated that later I proved a formula for the generic case of N men for the minimum number of weighings required. Back then with no internet, this kept me busy for a few weeks.
if every thing won't go as usual you will be selected.
my father came 1989 to Karlsruhe for his phd in computer science (FZI). he and you probably knew each other
You just whet my appetite. That's awesome
@@NaderHGhanbariwhat was the formula you proved with minimum number of weighings
I solved this puzzle in other way around
12 yrs back..
W-weigh, we give number to each on
Scenario 1, W1: four on each side 1234-5678 if it is balanced then it is simple to find the odd one from remaining 4, as follows W2: keep a person(12) aside n weigh like this 9,10-11, 1, if it is balanced then compare 12 with 1, ll know whether he is lighter n heavier. If it isn't balnced, and tilting towards 9,10 means either one of them is heavier r 11 is lighter, then W3:compare 9&10, which way it goes is the heavier one, if balanced 11 is lighter.
Scenarios 2: W1: 1,2,3,4 - 5,6, 7,8 unbalanced n shifted towards 1234, W2: 1,2,5 - 3,6,9 if still shift to 1,2,5 it means either one from 1&2 is heavier r 6 is lighter.. Then compare 1&2 which side it tilts is the heavier if balanced 6 is lighter. If 1,2,5- 3,6,9 is balanced means eeither 4 is heavier r one from 7&8 is lighter, then compare 7 with 8. if in Scenario 2 balance shifted to 3,6,9 side that means either 3 is heavier r 5 is lighter... Compare any one from 3&5 with normal one to get to know the odd one...
Ramesh Kiran's solution (almost same as mine) seems to be the best solution, so I've written it up below in clearer terms ("W#n" means the nth weighing):
W#1: Weigh 1,2,3,4 vs. 5,6,7,8.
If W#1 is balanced (odd one is 9,10,11,12), then:
W#2: Weigh 9,10 vs. 11,1.
A. If balanced, then W#3: weigh 12 vs. 1 to see whether 12 is light or heavy.
B. If unbalanced, then W#3: weigh 9 vs. 10; if W#2 had 9,10 heavier, then whichever side is heavier in W#3 is the heavy one (or if W#3 balanced, 11 is light); or if W#2 had 9,10 lighter, then whichever side is lighter in W#3 is the light one (or if W#3 balanced, 11 is heavy).
--------------
If W#1 has 1,2,3,4 heavier:
W#2: Weigh 1,2,5 vs. 3,6,9:
A. If 1,2,5 heavier (1 heavy or 2 heavy or 6 light), then W#3: weigh 1 vs. 2; whichever side is heavier is the heavy one (or if balanced, 6 is light).
B. If 3,6,9 heavier (3 heavy or 5 light), then W#3: weigh 3 vs. 12 to see whether 3 heavy (if balanced, then 5 is light).
C. If W#2 balanced (4 heavy or 7 light or 8 light), then W#3: weigh 7 vs. 8; whichever side is lighter is the light one (or if balanced, 4 is heavy).
--------------
If W#1 has 1,2,3,4 lighter, then the process is same as above, switching corresponding numbers.
Thanks buddy@qc1okay
Isn’t this a ted Ed puzzle
Noelle Rhee yup
@@qc1okay
Y these many scenarios ,
It's simple
11 are having equal weight 1 guy is over weight
3 times we have to use that sea saw
1) first divide the 12 members into 2 grps 6-6 weight them one side shall be heavier.
2)take the heavier grp ie 6 ....now divide them again into 3-3 as grps and again weigh them .you will get the heavier grpWho are only 3
3) Now of those 3 members tell two members to be on seasaw ..... If they weight equal ....then the 3 Rd guy is the different one .
And if any one of those 2 are weighing heavier ......he is the guy as other all 11 members are of equal weight.
Not at google but I was asked this question years ago for a server lab job. I did not know the answer and did not get the job lol. He said not one interviewee knew the answer. I still believe to this day if I knew this riddle I would have gotten that job.
When we are going to attend for aptitude classes.....we can easily test the trainer by giving this question....🙋♂️
Evarikaina ichavaa aa question?
Are you going to attend English classes?
teachers are also watching this video
Use the sand on the island
Measure the amount of compression one guy makes then see all compressions and compare the deeper or shallower one
Man u think out of the box 💯💯respect
Where would you find an apparatus for measuring the compression in the sand? Think realistically.
@@krishbedi6410 a stick. It doesnt need to be a ruler lol
Epik using a stick would not yield accurate results and also the compression of sand particles could result in the elasticity of the the sand as a whole
Hampering of the elasticity*
I watch the first minute of this video and then I paused it. I realized that I was presented with this puzzle in 1989. However it was presented to us as 12 balls and a balance scale that could only be used three times.
The professor wanted us to come up with the best route that will result in the highest potential of coming up with a solution. I came up with a solution the next day. When I presented it to him he said that I must have made a mistake. The reason was; when he was presented with the puzzle, it was presented to them as something that does not have solution. I'm glad that he had forgotten to tell us that little detail.
At first I thought this was one of those bs "Only 1% with 6000 IQ can solve" puzzles but it was a genuine programming problem. Thank you algorithm
for the first few minutes, "Ahh I got this, simply do it as TedEd has explained".
the second explanation, "Ohh wait, what was that? how could you... but... nevermind."
But i believe, even the first approach is not easy.. if compared with TedEd... because in their version of puzzle we don't have to figure out the DEFECT (if the object is heavier or lighter).
@@LOGICALLYYOURS when 2 set of four men left , try with balancing 1-1 in
@@LOGICALLYYOURS In this problem there is a trick that is "lever" thats why I would just say it cannot be solved. Cuz as you can imagine at seesaw the nearest man close to the middle, will be the lightest. But its true just for this question.
@@grayfurt95 Even if you factor in the lever, that implies that the force of a person's weight is relative to their position on the scale, as long as people or objects being weighed are evenly distributed along the scale on the scale and both sides have the same number of people, the problem is still solvable. If all people on the scale weigh the same, it will balance. If a single lighter or heavier person is on the scale, it will be uneven regardless of the outlier's position as there will be a difference in the total amount of downward force between the two sides of the scale.
@@LOGICALLYYOURS bro I actually found a realistic way to solve
The key idea is the "balancing with known normal men" part. That's what I didn't see initially when I considered how many to place on the see-saw.
This is based on a problem from a brazilian math professor Júlio César de Mello e Souza. during the 1930 decade. My father was one of his students and told that he was a wornderfull mathematician. I'd lije to suggest that the Google give credit to him. He wrote a book called "O homem que calculava" Something like "The man that used to do calculus"
Just found this: my father gave me this one when I was a young teenager. His only clue was "you must get the maximum amount of information from each weighing". When I couldn't do it, he amended this to "what does each weighing tell you?". I did it - in the end. Later on I did programming and got to know about the "even more logical" approach mapped out here.
Well after strong focusing on the procedure I still do not understand nothing 😂
Ya bro,same here with me🥴I made the first method myself and then I didn't get the second one explained by him😑
Don't apply for the job at google.... Hope you understand this..
@@manassinha9145 you don’t need to Ans to actually get a job
that means you understand everything if you don't understand nothing
First
I might be slow
But when there's an upload
I click so fast I glow!
Not going to lie, I had a migraine trying to solve this puzzle, but it was the good kind of migraine. Thank you for the challenge!
Thanks Freddy:) I appreciate your comments on many of the videos :)
I've seen this question many times before Google even existed...This is a famous puzzle.
I want to get job in Google
After watching this video,this has totally inspired me
Please complete the sentence...
Inspired you to ……?
I think in general you should balance the following three quantities as good as possible in every step (while making sure Left and Right contain the same number of people by filling up with Confirmed Persons):
A) 2 * Unknowns Outside + Suspects Outside
B) Unknowns Inside + Heavy Suspects Left + Light Suspects Right
C) Unknowns Inside + Light Suspects Left + Heavy Suspects Right
If not perfectly possible you should prefer to have the Inside a bit larger.
Reasoning: This optimizes the worst possible outcome of the scaling step.
After watching the second approach I'm like toote udh gye bhaishab 😂😂
Toote ,kabutar
Sab udgaye bro
🥴
My first solution had a slight difference: in the second weighting, on both sides I put two suspects to be heavy and one suspect to be light. This removes case 2b and adds an additional case 2c.
This is totally out of topic but isn't this the same riddle given by captain holt in the show B99 😕
Read the description
It's definitely older than that. The first time I heard this puzzle was from my uncle when I was a kid. It was years before the release of the show. Now I wonder about the origins of this puzzle.
Yes, but it wasn’t invented by Brooklyn writers.
Yeah obviously it must be much older of a puzzle ..... I was just pointing it out that this was mentioned in that show as well 😅
I mean I'm here cause I saw the title and thought of B99 😂
I don't know if this is right but I did pause at the beginning of the video. Here's how I would solve it. Put 6 men on each side. The side with the odd weight will be highlighted. For the 2nd time put in 3 men on each side and again the odd will show up leaving 3 men. Now on the last time I could use the seesaw, I am gonna put 1 on each side. If it tilts then there goes the odd one. If it's balanced then it's the one standing. 👌🏻
How do you know which side has the odd weight? If the seesaw tilts right, it could either mean there’s a heavy man on the right side or a light man on the left
I did group of 4 vs 4. Then shift out 3 pleople from the left and shift in three to the right. Weigh again. By tracking which way scale tilts you can tell which group of three has lighter/hevier person. If last guy is left alone just weigh him against anyone else. .
When u answered 1 but friend told you answer is Egypt
Wow ! Soo Difficult !! I am grateful Google doesn't ask these questions nowadays otherwise every applicant will get the job !!! 🤣🤣🤣
The hell of a question and hell of an explanation.. we need to get to the 2nd approach to make computers work... Hoping to get these type of puzzles 🤛
This puzzle actually gives a glimpse into how an AI model is trained. It compares known data to the test data. ;-)
Actually, the 2nd "solution" is a great example of poor optimization - that is, optimizing the WRONG THING. The 2nd solution only works better on an ideal machine - one which has no performance limits based on data set size, and no memory performance limits. Such machines, of course, don't exist in the Real World, and thus, the optimization done in the 2nd solution will perform significantly worse than a solution that uses the 1st solution as it's base algorithm, but which is tuned to understand how limits of hardware affect actual computation.
@@eriktrimble8784 for optimization, both explanations in the video are wrong. Elimination by consistent half is always mathematically the fastest procedure for narrowing. and also finds the Odd man in three steps in this situation. this approach would not always tell the weight of the odd man. but it would be more proficient to weight the odd man at the end instead of considering the weight of everyone during the process.
The big problem that threw me off track when I first was confronted with this problem in the late 90s is the amount of if/then/else branching you have to do. And if you know the 9 ball / 1 heavier problem, it actually makes it harder for you to solve this since you start off trying to solve it the same way, which does not work.
Google taking indiana jones' puzzles as interview questions XD
The solutions presented are quite impressive. My personal solution involved some lateral thinking:
1. Take half of the 12 men randomly, and weigh them against each other (3 vs 3). If the seesaw is balanced, we know the other half of the men contains the suspect, otherwise he is in the half that was weighed. So now we have identified the suspect group, and the even group, each with half of all the men.
2. Take the even group and put them all on one side of the seesaw, and the suspect group on the other side. The seesaw will be unbalanced slightly, and now we will know whether the suspect is lighter or heavier .
3. With all the men still on the seesaw, instead of having everyone get off at once, have just 1 man from each side get off at the same time, and continue the disembarkation in this manner. When the seesaw becomes balanced, pause to acknowledge that the last man who got off the seesaw from the suspect side is the one with the odd weight, unless it is the last man from the suspect group in which case it will remain unbalanced when there is one man left from each side.
This technically only uses the seesaw twice, and can be scaled up to any number of men assuming the seesaw is big enough to support them all. The method of each side taking it turns to let a man off makes sense too because the first man to get off will make the other side heavier and sink closer to the ground, making it easier for them to leave.
Actually, each observation is considered a trial, so this doesn’t work in the allotted trials. Good logical thinking, though. 👍🏻👨🏼🏫
@@TomCee53that depends on definition of 'use' in the problem. Which opens the possibility for many interpretations
pick one to stand on seesaw...and line up everyone else..........done!
That is why a computer programming definition is more precise. You can call a function measure(men_left_side, men_right_side) which gives you the output L, R, =, and you can only call it 3 times. No ambiguity.
Thnks a lot, it's really beneficial to all CSE students...This is a very good concept for dynamic programming
Thanks Sachin :)
I created the same puzzle to challenge myself when I was a high school student back to 50 years ago. 12 coins with one fake without knowing it is heavier or lighter, the measurement tool is a balance scale. The solution I found was divided them into 3 groups, 4 each. 1,2,3,4 5,6,7,8 and, 9,10 ,11,12. The first measurement is to place 1,2,3,4 on left side and 5,6,7,8 on right side. If it is balanced, 9,10,11,12 has one fake coin, it's easy to find it with 2 measurements. If it is not balanced, then the tricky part is to do a rotation. Left side to be 1,6,7,8 right side to be 5,10,11,12. Then you'll find 2,3,4 or 6,7,8 or 1,5 has a fake coin in it. You can easily find it with 3rd measurement. Then I ask myself what is the maximum coin I can inspect with 4 measurements? How about 5 and more? Then I found the answer is 12*3^(n-3). I read most of the comments, I like the one solution to use 3x3 grid.
I remember reading a solution in verse to the 12 coin problem in the early 1970s, possibly by H E Dudeney:
"F" set the coins out in a row
And chalked on each a letter, so
To form the words: F AM NOT LICKED
(An idea in his brain had clicked)
And now his mother he'll enjoin:
MA, DO / LIKE
ME TO / FIND
FAKE / COIN !
My solution to the problem was to divide all the 12 men into two groups and put them on either sides of the see saw, obviously it will be imbalanced. Then we ask one person from each side to step down together and when the see saw becomes balanced this way, we select the pair which stepped down at last. The suspect is one of them. Then we can weigh the two of them one by one with a safe person to know who it is and if he is lighter or heavier.
too many uses of the see saw
12 men into 2 groups
6-6.
One side will be unbalanced
Take everyone off the see saw. Take the 6 from the unbalanced side and split em 3-3. One side will be unbalanced.
Take everyone off. Take the 3 left, put 2 on the seasaw. If it's equal then the one not on the sea saw is the odd man. If it's not equal then you've found your odd man.
Took me around 30 seconds. Put 4 on each side and leave 4 out. If the scale tips remove the 4 left out and the high side. If it balances remove those 8. Then take the 4 that were on the low side or the 4 that were not on the scale. Place those 4 men on the scale, 2 on each end. Remove the two from the high side. That’s the second scale move. Then take the remaining two men and put them on the scale. The heavy guy drops the scale to his side. That’s the third scale move. I then watched the video and the explanation. His explanation had me shaking my head
I don't want your job, Google.
Thanks bro for questions actually its improving my logical thinking I actually solved it using COM(physics) concept. 👍👍
This is indeed a nice puzzle which tests your logic and patience.
The solution i came up with :
Just devide them into 2 equal groups and place them on the seesaw
Then let them jump down one by one ,
1 man from each side at the same time
When the pair with oddman jumps down the seasaw will be balanced
Then we know one of them is heavier or lighter
For the 2nd time
Just weigh one of them with a normal man
If he is the oddman we will know
And if the seesaw balances then the other man is odd
And we just have to weigh him with a normal to know if he is heavier or lighter
You can't perform such jumping
every time you let people jump off the seesaw you are essentially weighing the remaining people, counting against the three weightings that are allowed.
haha;;{{)) love it,... yeah, you're right,...
Lesson learned :
Always take a weight machine with you, when you go to an island. 🙏
😂
True af
Took the one who gave me the puzzle 20 years ago 2 weeks to solve it. I did it in 2 days. Didn't make me very popular with him. I guess there are people who, without being trained in such logical structures, just take a few seconds.
I haved watched almost all of your videos...and this video could be hardest one😂
Old problem. Great one. Took me 6 months. Took my sister 10 minutes without paper and pencil.
Turns out I'm not interested in any job that throws puzzles at you when hiring.
Yah fuck logical reasoning
New Google hire brilliantly solves the puzzle!
First task: "Could you help us maintain this Excel spreadsheet that tracks business metrics?"
Thank you very much sir for sharing such a important and valuable problem with solution and all your videos helped me a lot in improving my knowledge and I am now able to ace many of the aptitude test and I am really thankful to you a lot sir and plz keep posting videos. I am your big fan sir
I'm really happy to see your comment. Much appreciated:)
Thank you sir
The moment when you thought you were smart and are proven wrong...
Then it means that you've learned something new, so it's a win.
Next time you're stuck on an island with 10 other unknown men who weigh the same, remember this 😌
Then the first thing that will come to my mind is "how to get the hell out of here"..
My solution. Put half men on each side. It will either R or L. Now, each side put a man down so they come down in pair.
See when the seesaw become balance. The last pair is the one having odd man. Weigh one of them with one normal man.
You got your answer dude. Even with 100 men you only need 2 weighing.
I ask this puzzles I'm my tution and no one is able to answer
You're your tution?
Oh I actually solved this problem back in 2019 or 2018 because a friend sent it to me. Spent a good 30 min on it.
This problem was the climax of _With a Tangled Skein_ by Piers Anthony. The solution given was the same if the first weighing balanced, but it had an interesting concept for when the scale was unbalanced.
Suppose at first weighing, you have:
W1: H1 H2 H3 H4 vs L1 L2 L3 L4
Meaning the side with Hs is heavier and the side with Ls is lighter.
Then proceed as follows:
W2: H1 L1 L2 L3 vs N1 N2 N3 L4
If this balances, the odd one is one of H2, H3, or H4.
Weigh:
W3: H2 vs H3
If this balances, the odd one is H4.
If this does not balance, then the odd one is the heavier one of H2 and H3.
But if W2: H1 L1 L2 L3 vs N1 N2 N3 L4 does not balance, there are two scenarios:
If the H1 L1 L2 L3 side is still heavier, then the odd one is either H1 or L4.
Weigh:
W3: H1 vs N1
If this balances, then the odd one is L4.
If this does not balance, then the odd one is H1
If the H1 L1 L2 L3 side is now lighter, then the odd one is one of L1, L2, or L3
Weigh:
W3: L1 vs L2
If this balances, then the odd one is L3.
If this does not balance, then the odd one is the lighter of L1 and L2.
My version with coloured hats (all hats have equal weight)
Strategy behind this is, roughly, that you have 1/3 of non-greens off-scale, 1/3 of them staying on their side and 1/3 of them switching side. If the scale balances the odd one is off the scale, if the scale switches the odd one is in the group that switched and if the scale stays the odd one is in the group that stayed.
1. Everyone gets a white hat (white like blank paper)
2. Whenever the scale is balanced, everyone on it trades their hat for a green one (green like all good, not the odd one out)
3. Whenever the scale is imbalanced, everyone NOT on the scale gets a green hat (because the odd one out must be on the scale)
4. On the "lighter" side, if any, white hats are traded for blue hats (blue like air) and black hats (black like ground) are traded for green hats.
5. On the "heavier side", if any, white hats are traded for black hats and blue hats are traded for green hats
6. Start by weighing 4 vs. 4. You get 8green/4white or 4blue/4black/4green.
7. Continue weighing 3 white vs. 3 green or 3blue+1black vs. 3green+1blue
8. You now have 1 white or 3 blue or 3 black or 1 of each blue and black, all the others are green (this is a bit tedious to check, but straightforward).
9. weigh 1 blue vs. 1 blue or 1 black vs. 1 black, if possible. If not you weigh a non-green vs. a green.
10. You now have 11 greens and a blue or a black (even more tedious to verify, sorry).
Me: *Doesn't understand something*
Random indian man: I shall reach you.
I correctly attempted this question but im glad to watch through ur vedio again
It's basically a mathematical induction of finding out the Imposter in Among Us.
I came up with a totally diferent approach. If the defenition of using the scale is to put objects on it to see the result I would:
1, Place everyone on the midle and ask one person on each side to walk to the end. The scale will be balanced until we find the odd one. then we have two candidates.
2, Compare the first candidate to the control group in the midle.
3, Compare the second one to the control group if needed.
Man, everyone thinks they've stumbled into greatness pretending constant adjustment and observation is a single instance of weighing.
The biggest problem of this interview question is that it does not tell you anything about the quality of the candidate, no matter if his answer is right or not. That is why Google failed in more projects then he successfully finished 🙂
Actually this type of question does help know more bout a person. It helps Google know whether the person is a creative, quick or logical thinker. By answering the question in a creative way, maybe google would want to hire them, for creative solutions to problems. If they can answer the question quickly, then that person is great for quick responses to problems. And if they are logical in there answer then, there’s a great chance that the person makes smart decisions. Also if the person maybe takes longer to answer, they may be the type of person to make an informed choice to a decision. All these types of answering a simple question could really show how the person thinks when asked a spontaneous question. Although I do agree that only 1 question does not determine how the person actually makes decisions or choices, it gives a good gist on how the person thinks in an interview setting, with the stress. 🙂
Literally any question can at least lead to inference of something qualitative. You have no clue what position the person is applying for or what qualities that are looking for, just made an empty negative claim.
@@TheJacklikesvideos During my carrer, I have interviewed dozens of people and yet I am far from to be an expert but I have at least SOME experience. May I ask you what real experience you have?
This would have taken me about 25 million factorial years to solve the way you did! The brute force approach however is very simple and easy to implement, and takes less than a second even for large sets.
Honest man , same goes with me.
Good one...
I've finally managed to do it. Man, that was really hard, but what a satisfaction, I can hardly believe I came up with the solution xd
I hear you David! I knew there was a perspective to approach from, I kinda created my own math language to write out the hypothetical situations. Once you really understand the rules, it seems super simple. At first I wanted to be creative with unequal numbers of men/not even using the seesaw. But even after trial and error, I think anyone can slowly learn how this puzzle works. Glad you figured it out! I usually feel like I can’t solve some problems, but yes very satisfying!
So simple first divide 6-6 then weigh them then take odd one side on account then divide them 3-3 then take odd again and then chose randomly two of them and eliminate the the odd one
So ... First of all, this was an eye opening exercise, but now I'd like to ask a few questions, and I hope someone can answer them:
1. We discard 2 combinations at 15:52, does it mean that we could technically solve this for 14 people?
2. 17:30. Must we choose from each section or can it be, for example, both from orange section?
3. If we had an odd number of people (say, 9 or 11), would this table approach work?
4. Which books would one suggest to read about this subject.
Generally, if you're scaling this for large numbers, you can weigh ⅓ vs ⅓ of remaining candidates each time. The first time the scale is uneven just weigh one side vs. standard weights and you've solved for heavier or lighter and simplified the problem to paring your candidates down to ⅓ previous with each weighing with no need to sort or label them.
14 people x 2 (heavy light) = 28
3^3 = 27 possibilities.
You can't even solve this for 13 people, even though it seems like those 26 different possibilities would just fit within the 27 possible results of 3 weightings.
The reason is that you always must have an even number of people on the scales to measure balance. If you weigh 8 at the first weighting and it evens out, then one of the 5 remaining is the odd one out - 10 possible combinations with just 2 weightings to go. Yet if you weigh 10, and the scale tips, then there are 5 that could be heavy and 5 that could be light, also 10 possibilities. 13 is just too much for 3 weightings.
Here is a simpler algorithm for the general case: For each step, balance the Positions in such a way that 2 * Unknowns + 1 * Suspects is the same no matter what the scale does. (If not perfectly possible, place the remainder ON the scale.)
This does not account for cases where there are not enough Confirmed Persons to make sure both sides of the scale have the same number of persons.
Working solution. I've solved this puzzle the same way.
Fantastic. almost 1 and a half hour, but my nephew and I solve it!! :)))
But when given in an interview, how much time do we have to answer and do we get pen and paper?
We get pen 🖊️ and paper 📓 but only three minutes
@@haio7710
Three?!!!
No thx
Jesus did anyone ever solved it without knowing the solution beforehand?
@@guitaek4100 Ofc not. Thats why youll never have a riddle on a job interview. It doesnt provide any info about the candidate. Its pointless. Talking as a Psychologist.
@@svilenacarapica4491 Interesting. In my job interview I had a riddle (not google) I didn't found the solution my own however I found an own (not as good as) solution. I guess it should test you wether you're creative. So why do you think it's pointless?
2nd way is take 11 mens first one in COM of see saw and 5 on left 5 on right then If one of them weighs more take those 5 mens (also as we know the middle one is not the odd men so we discard that man) and 2nd time make them sit 2 on left and 2 on right one on the middle and If this time also the more wighted 2 mens left take the COM one out take these 2 mens out.
Then in last attempt you will get to know that who is more in weight definitely cuz this time only 2 mens are left and also the man which was left at first would not be the man with odd weight cuz if he was then there would be case 1 which I answered in the comment already
Hope it helps 👍👍
I’m Quite Sure That This Is. a Teded Riddle. I remember doing a similar riddle like this
You need to identify whether the defective object is lighter or heavier.... that makes it difficult.... whereas in ted-ed version you don't have to find out the defect.
Yes ur right
Yup the coin riddle
kabir md in ted-Ed version, you don't know whether the fake coin is lighter or heavier too.
@@Thaplayer1209 that video gives the path to determining both the odd coin and whether or not it is heavier or lighter
There is an alternative way describing the 2nd method:
Again, we use the seesaw independently. Instead of encoding on the results, we encode the men.
We have total 3 times to use the seesaw. So, a man is encoded as X = (X₁, X₂, X₃), where Xₖ can be R, L, 0, and Xₖ = R (L) means this man appears on the right (left) side of the seesaw for the k-th turn, and Xₖ = 0 means the men does not appear on the seesaw for the k-th turn, k = 1, 2, 3.
Now, the rule of encoding:
0. Of course, each man must have a distinct encoding.
1. Each turn, the number of men on the right and left sides must be equal, i.e. the number of R assigned to Xₖ must be the same as the number of L assigned to Xₖ, for all k = 1, 2, 3
2. Each man must appear at least once on the seesaw, so you can not encode (0, 0, 0) to a man. (because even though we find everyone else having equal weights, we cannot make sure this odd man to be heavier or lighter: he never went on the seesaw!)
3. If an encoding is assigned to a men, the inverse encoding (R L, e.g. X=(R, 0, R) vs X=(L, 0, L)) will be dropped (cannot be assigned to another man), otherwise since the two men always take the opposite positions, if one of the two men is the odd man, we cannot distinguish them (the results would be either A is lighter of B is heavier, but we cannot make sure which man of the two is odd).
Similar to the arguments in the video, it's obvious that we need to drop (0, 0, 0), (L, L, L), and (R, R, R) to make number of R's and L's balanced. Similarly, we have 27-3 = 24 combinations, and by Rule #3, we only use half of them, and drop all the inverse encodes: So we use only 12 combinations, and assigned to 12 men.
We further define the 3 results Y = (Y₁, Y₂, Y₃), where Yₖ can be 'R', 'L', or '='. Yₖ = 'R'('L') means the seesaw resulting in Right (Left) side heavier, while Yₖ = '=' means the seesaw balances, at the k-th turn.
After we assigned the men's encoding, it's obvious, for example, if the results of the three times are Y = (L, R, =), it must be some men encoded either X=(L, R, 0) or X=(R, L, 0) to be the odd man. In this case, If we found a men is encoded as (L, R, 0) , we can also confirm this man is heavier (because the man stayed each time on the heavier side), while if we found men is encoded as (R, L, 0), we can confirm that man is lighter.
This puzzle features prominently in the climax of Piers Anthony's book "With a Tangled Skein", which I read about thirty years ago. The protagonist had made a bet with Satan and was weighing demons.
Obviously the puzzle was a memorable one, since I still remember it!
I had forgotten that until you mentioned it. Piers Anthony is one of my favorite authors. Thanks for the memory.
Amazing
It is a variation of the "fake coin" problem that we were solving in a high school. Our nice solution puts the people in a grid 3x3 with the extra 3 diagonally. Then you weigh two columns against each other and depending on a result you pick two rows to weigh against each other. When you look at it you'll see the solution right away without a need for any spreadsheets. Still nice though.
amazing!!
On the first minute of watching this video answer just poped up in my mind
We Can devide 12/2 so 6 on each side in the first round we'll knockout 6 lighter ones
Than on second round we'll test heavier 6 by doing 6/2 = 3 on each sides
Again we'll take heavier 3 and now on the last round we'll Put any two there if it's still balance that means the remaining one is heavier else if seasaw worked so heavier one will be down
Damn..... It was totally awesome.. tho i was lost
A seesaw does not compare weights. It compares torque. It will balance = only if torque is same on both sides and that's highly unlikely as men will not be at exactly the same distances from the center. The puzzle makes much more sense (cents?) with coins on a balance scale where the weight is concentrated at the pan's suspension point.
Why's the solution you're proposing so complex, it's just a basic binomial sort and takes less than 30 seconds to solve
Omg! Decades ago our middle school math teacher gave us this puzzle, except there were coins and balance scales.
Before watching, my first guess is to just put 8 people on the seesaw, four on each side. If they’re all equal, then you’ve refined it down to the other four. Either way, you end up comparing only two men on the third time around.. I think
All 12 on the seesaw, 6 on each side. Then have one from each side step off. Repeat until there's a change. Once the change is found have all step off and the two that caused the change to get on one side with two others on the other side. Have one from each side step off. Change? Then the one that stepped off on the affected side is guilty. No change? The other is.
I've used the seesaw twice. To use the seesaw you have to load it and then unload it. The load/unload process happened two times.
Someone needs to make a game with all these difficult logic games. Ooo and in VR
Whilst the maths is very impressive, I would be asking...1/How do you know one man weighs diferently before the exercise starts if they haven't alteady been weighed? 2/Why can we only weigh three times? 3/Why do we need to know who has a different weight? 4/What are the men doing on the island?Knowing why you are doing something/the purpose of the data is also important. Logic. X
Okay, Now I got why I am not in Google. 🙄😟😅😂
Logically The is no seesaw that 10 Persons can fit😂...
Nice Explanation. Just a bit of correction though. Last part (3^x-3) that you wrote by the justifying -3 as 1 for === and 2 for equalling L and R. That should be (3^x - 2*no. of men). Because you see for 12 men it eventually turned out to be 27-24=3 (Making extra 3 possibilities so -3) but for 100 men it will be 243-200=43 extra possibilities. Love your videos. Thank you.
he said to remove at least 3 rows which means greater or equal (43>3) so no need for a correction . if you try this with just 13 people you'll need to discard 3^4-26 = 55 possibilities since 3^3-3 < 13*2
that equation was to find out number of weighing required.
we can eliminate extra lines later.
Just to add on this, coding this is actually very trivial, because if you assign L=0, (=) = 1, R = 2 than the numbering of the people will match the weighting scheme if you look at the numbers in base 3
Appreciable effort
I have another answer for 1st question
Seperate into 2 batches 6 and 6 balance them once 1 batch will either weight more or less then again seperate the weight variation into 2 batches 3 and 3 one batch will varry and balance the 2 guys while 1 guy waiting if they both weights same then the remaining person is diff weight
That was my solution
problem with that is that after first step you dont know which group has the odd man, because he could either be heavier or lighter
Simply we measure the footprint in a seashore to know the weigh of a odd man ,no need see saw
Wouldn't that indicate pressure though, not weight? They would have to have exactly the same size feet and the sand be perfectly the same density across the beach.
@@jessicataylor7174 yeah you are correct...
If there is very minor difference.. You can't? In case instead of men balls are given.. ?
Ah, there's always that smartass who thinks he's thinking outside the box. It's a riddle that specifically asks you to use the seesaw, its not asking you to find the differemt weight using any means possible. Otherwise just ask the men about their weight lol.
My brain with the first case: oh well, duh! Just what I was thinking!
My brain with the second case: 😵💫
I found a diffrent way: It has to do with the fact that the distance from the center matters. Ex if the odd man is near the end the saw's change will be more dramatic. Using this approuch we can split the men in half and find two possible candidates. Weight each candidate with a normal man and boom it works. It also works with any amount of men.
But you don’t know how much more or less the odd man weighs. If someone slightly lighter than the rest would stand near the end, wouldn’t the change be less dramatic compared to if someone much, much heavier stood closer to the center? We wouldn’t know the difference in weight and therefor this approach could fail to find the odd man.
The correct answer is to say, "Excuse me... This question is fat-phobic and I want to talk to your manager." That's how you get a woke job at a woke company.
Me(when he said there is a twist at the end):are they blind???..... Can't they figure out just by seeing!!! Lol i was wrong.. 😂😂
I use only two time, first time 6-6.
One side wight is large,
Split the large 3-3.
3-3 using seesaw.
There are equal the odd one is lighter to others,
3-3 are not eqal the odd one is heavier.
You're hired👌
@@avlieox thanks bro
Where or in which real-life system this algorithm can be used.
I'm just curious
It is not, they just want to find a person with right problem solving thinking that souts for the position they are hiring.
@@stefanpodgorsek7687 What if my problem solving skills are average but I binged watched all the Ted-Ed puzzle/riddle videos, and just happened to see the one about finding the counterfeit coin in a pile of 12 coins using a scale?
It is more of a test to see if you can recognize a situation that can be solved with a hash map
It took me about 2 hours but I solved it! Well, the first way. Not the one with the tables that you can scale up as needed.
3 friends A B and C,C knows how much time A and B individually watched Titanic movie.C said, between a and b, one of them watched the movie 1time more...
A said B= video watched one time more than me?
B replied- No,Did You?
A said- No,but i got it, how much time you watched Titanic movie.
B said,- O really? Then I also know how much time you watched Titanic movie...
Question is how much times A and B watched Titanic movie?
A: once
B: twice
But I think this one is also a possibility
A: twice
B: three times
isn't it?
If b didn't know that at start how many times a watched , how could he ans the first question ?
@@anksssssssss I think the writer meant to write "A to B: Did you know whether you watch video more than me?"
I like more version where there are 13 men. All rules are the same, but you need to find which one is diffeerent weight. You dont have to tell if he is heavier or lighter. Good luck with that.