Answers to one of Google's interview questions about weighing 8 balls

Source: Internet
Author: User

 
One of Google's interview questions: there are eight balls of the same size, 7 of which are of the same weight, with a slightly heavier one. How can I use the balance to determine which ball is heavier only twice?

Answer:
For the first time, I took out 6 of them and placed them on the balance, each weighing 3. I can determine where the heavier one is. There are three situations: 3 on the left of the balance, in the 3 on the right of the balance, or in the remaining 2.

For the second time, we can find a very important one. For the first two cases, we just need to take out two of the three, and place them on the balance to know: if they are different, if the two values are the same, the remaining values are the same. In the third case, it will be called by Tianping.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.