Microsoft interview question selections-9

Source: Internet
Author: User
By a new (Seraph chuyun) -- http://com.6to23.com/

========================================================== ========================================================== ========================================

After reading the programmer magazine last year, these questions were obtained from the previous questions for the students at that time.
Upload it now to see if you will do it. All questions have been answered correctly and will be published later.

Bytes ------------------------------------------------------------------------------------------------------------------

Note: The question "*" in front of the question number indicates the difficulty of the question considered by the editor. The question is ** (I did not do this yet ~); The representation without * is extremely simple.

The answers to the following questions are not answered correctly. The answers are all the answers that the editor thinks (the last question has not been answered yet ),
Note that the normal problem solving time after the question is taken as a reference,
Example: 30 s ~ 2 min means that the time for solving the problem is between 30 seconds and 2 minutes.
I do not think that my abilities are too long (or too weak), so it is a normal time to solve the problem.

========================================================== ========================================================== ========================================

1. tiered testing(The last question is difficult * very difficult, and the difficulty of the first two questions decreases accordingly)

When I walked down a road, I met two people. One person always tells the truth and one person always tells the truth. You don't know who told the truth and who told the truth. You just asked one of them a sentence, it's time to go there.
(Normal problem solving time: 30 s ~ 2 min)

Three children with their own cross-river, only one boat, each carrying only two units, when an adult is not around, if the child is surrounded by other adults, then he or she) there is danger,
Q: How can I make it happen without danger.
Note: When the ship comes back, there must be at least one unit on it.
(Normal problem solving time: 1 min ~ 5 min)

** ③12 balls and a balance, now know that only one is different from other weights, ask how to name it to use three times to find the ball. What about 13?
(Normal problem solving time: 20 minutes ~ 60 minutes. I have answered the question in nearly 40 minutes)

========================================================== ========================================================== ========================================

Ii. Microsoft interview question Category Selection(For some questions, refer to "programmer" magazine. All are answered by myself, and the answer will be published later)

Bytes ------------------------------------------------------------------------------------------------------------------

I. Microsoft questions-basic theoretical application skills

A train departs from L. A. to n. Y. At 15 km/h, and from N. Y. to l. .;
A bird departs from Los at the same time with the two vehicles at 30 km/h. After encountering another train, the bird returns and reciprocating to the two cars to seek its movement displacement and distance.
(Normal problem solving time: 5 minutes ~ 10 min)

Bytes ------------------------------------------------------------------------------------------------------------------

Ii. Microsoft questions-logical thinking ability

There are enough red, yellow, and blue balls in the same container. Now we need to take two balls of the same color, at least a few.
(Normal problem solving time: 1 s ~ 10 s)

A sufficient amount of water, 3 ml, 5 ml containers each, how to test 4 ml of water.
(Normal problem solving time: 20 s ~ 40 s)

Bytes ------------------------------------------------------------------------------------------------------------------

Iii. Microsoft questions-knowledge migration capability

* ④A sufficient amount of water, 3 ml, 5 ml containers each, how to determine all the normal volume of water through them. (It cannot be pieced together with 1 ml)
(This is a self-developed question that is more difficult than the previous question. I want to know which ones in my daily life can determine the number of normal ones. Normal problem solving time: 20 s ~ + ∞)

Bytes ------------------------------------------------------------------------------------------------------------------

Iv. Microsoft test questions-comprehensive competence in real life

* ⑤Four containers containing pills have a certain quality. One of the containers is fully loaded with deteriorating pills. The quality of the four containers is normal pill quality + 1. How to judge the deterioration of pills in the container once.
(Normal problem solving time: 10 s ~ + ∞)

* ** 6A worker works for you for seven days and returns a golden stripe (since it is said to be a golden stripe, should it be unable to bend it ?),
You have to pay them for a period of time every day, and you can only cut it twice. How do you pay?
(I have not yet obtained a correct solution. The problem solving time is tentatively set to + ∞)

========================================================== ========================================================== ======================================

Tip:I. ①, ② omitted; ③: too many. If you are interested, give it ......

Ii. ① omitted; ② 4 times; ③ omitted;

④ With the third question, it should be difficult. As long as you know, if you do not know about it for half a minute, you will never be able to do it.
Think about the RMB denomination settings.

⑤ If you think of the right path ...... 10 seconds is enough. If not, it will never be possible.
Take different quantities of pills from four containers and divide them into two groups for weighing.
For example, take 1, 2, 3, and 4 pills respectively in container 1, 2, 4. Put these 10 pills together and weigh them.
Determine the difference between weight and standard value (for example, assume that the total weight is 10 times the standard value + 2, then 2 is the deteriorating pill)

6 if the gold bars can be bent off, it would be nice to do ...... However ~~~ I hope that I will be able to tell you what I will do, and I am waiting for you to give me some advice.

========================================================== ========================================================== ========================================

Payment questions(This question is answered by Dr. Zhang)

The golden bars are divided into three sections at the beginning of 1/7 and 3/7: 1/7, 2/7 and 4/7. The first day is paid to 1/7, and the second day is taken back and paid to 2/7.

Bytes ------------------------------------------------------------------------------------------------------------------

Cross-river troubleshooting

Adults and Children: A; B; C;
1: A & A goes over, a stays, and a returns
2: B & C past, B Stay, c Return
3: A & B past, B, B stay, a, a return
4: A & C past, a, c stay, B Return
5: A & A goes over, a stays, and a returns
6: A & B past, a stay, B Return
7: when a & C passed, all of the above answers were made by me on the other side. The standard answers are definitely not unique. If you have a simpler solution, I 'd like to give you some advice.

Bytes ------------------------------------------------------------------------------------------------------------------

Question Answering and summary

They are a B c d, e f g H, I j k l, respectively.

First case:
If the weight is equal, the request is in ijkl,
Weighing I J,
If they are equal, compare a K. If a = K, then the value is L. If the AK is not equal, the value is K.
If not, compare a I. If a = I, the request is J. If not, the request is I.

Second:
If ABCD is light,
Remove fgh from efgh, replace BCD from ABCD, and extract ijk from ijkl to fill the space in E:
If afgh is light: It indicates that the requested ball is a or E, take E and any ball except a. If the weight is equal, the requested ball is a. If not, then the expected ball is E.
If afgh is heavy, it indicates that the request is in fgh and the request is heavy. If the afgh is heavy, the request is H. If the afgh is not heavy, the request is heavy.
If the request is the same as that of afgh, it indicates that the request is in BCD and the request is lighter.

Third:
If ABCD is heavy,
Remove fgh from efgh, replace BCD from ABCD, and extract ijk from ijkl to fill the space in E:
If afgh is heavy: It indicates that the request is in a or E, take E and any ball except a, if the weight is equal, the requested ball is a; if not, then the expected ball is E.
If afgh is light: It indicates that the request is in fgh, And the request is light. If the request is f g, the request is H. If the value is not equal to the value, the request is heavy.
If it is the same as the weight: It indicates that the request is in BCD and the request is heavier. The following is the case where afgh is lighter.

This is the answer. Next we will discuss with you the versatility of the number of free balls.

Summary:
Weighing on the balance, two pallets are relatively light and heavy, plus the tray outside, that is, each weighing has three results, that is, Ln3/ln2 bit information. You need to know one of the N balls. If you know whether the ball of different weights is light or heavy, it is one of the N results, there is ln (N)/ln2 bit information. If you do not know the weight, it is 2n (one of N balls is light or heavy, so it is 2n) one of the results is ln (2n)/ln2 bit information.
Suppose we want to name it K times. According to the information theory, there are obviously two situations:
(1) K * Ln3/ln2> = ln (N)/ln2 (k> = 1) obtained K> = ln (N)/Ln3
(2) K * Ln3/ln2> = ln (2n)/ln2 (k> 1) obtained K> = ln (2n)/Ln3
This is the lower limit, and it can be easily proved that the minimum positive integer k that meets the condition is what you want. For example, if you know the weight three times, you can find different balls from 3 ^ 3 = 27 balls. If you do not know the weight, you can only find different balls from (3 ^ 3-1) /2 = find different balls in 13 balls.

Bytes ------------------------------------------------------------------------------------------------------------------
From: http://chinaitpower.com/A/2002-01-05/9999.html

Related Article

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.