Microsoft interview questions

Source: Internet
Author: User

There are 12 table tennis balls of the same size. Only one of them has a different weight than the others. You must use a Tianyan without weight to identify the ball with different weights three times!

By chance, a dear friend asked me this question. At that time, I thought the ball was heavy (I used to do something similar, inertial thinking) and thought it was very simple, later, I thought about how difficult it was, and I didn't even figure it out after I went to bed for half an hour. I went to bed that day and fell asleep with this problem. Fortunately, I came up with it the next day.

Roughly as follows: divide the ball number 1 2 3 4 5 6 7 8 9 10 11 12 into three groups;
First 1234 and 5678
1 if they are equal:
The problem lies in the third group. This is relatively simple and will not be analyzed.
2. If the weight of 1234 is greater than 5678, it may be a ball in 1234 or a ball in 5678 is lighter;
The key is to determine whether the rating is heavy or light, and to narrow down the scope;
We will combine 5678 with 12 in the first group, that is, 156 and 278.
A: If they are equal, the problem is that the 34 balls are the 34 balls. The 34 balls are called the 34 balls as heavy as the 34 balls, because the 34 balls may have the same weight;
B: If 156 is greater than 278, it may be caused by 1 or a ball in 78, because 56 may cause only light problems, and 2 may cause heavy problems, so I'm sure they don't have any problems. If we compare 78, if it's equal, it's 1. If we don't wait, it's a light ball, it's a problem ball,
C: The analysis method is similar to that of B. It will not be repeated.

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.