Classic interview questions

Source: Internet
Author: User

Smart question 1

After winning 100 gold coins, five pirates discuss how to make a fair distribution. They agreed on the allocation principle: (1) drawing lots to determine the order of numbers (, 5) for each individual's distribution; (2) proposing a allocation scheme from the pirate who obtained the signature 1, then, five people will vote. If more than half of the people agree to the plan, they will be allocated according to the plan. Otherwise, they will throw the 1 to the sea to feed the shark (3) if No. 1 is thrown into the sea, the allocation scheme is proposed by No. 2, and then the remaining four vote. If and only when more than half agree, will be allocated according to his proposal, otherwise it will be thrown into the sea; (4) so on. It is assumed that every pirate is smart and rational. They can carry out rigorous logical reasoning and rationally judge their own gains and losses, that is, you can get the most gold coins under the premise of saving your life. At the same time, assuming that the results after each round of voting can be successfully executed, then what allocation scheme should be proposed by the number 1 pirate so that they will not be thrown into the sea, can we get more gold coins?
Solution 1:
First of all, starting from pirate 5, because he is the safest and has no risk of being thrown down from the sea, his strategy is also the simplest, that is, it is better that all the people in front of him are dead, then he can win the 100 gold coins. Next, let's look at the 4th. His survival chances depend entirely on the fact that there are still people living in front of him, because if all the pirates from 1st to 3rd feed sharks, if only the 4th and 5th accounts are left, no matter what allocation scheme is proposed on the 4th, the 5th account will definitely vote against the scheme to allow the 4th account to feed sharks, to swallow all the gold coins. Even if the 4th bys on the 5th to save their lives and proposes a scheme like (0,100) to allow the 5th to exclusively occupy the gold coins, the 5th May feel dangerous to keep the 4th, and vote against it to let it feed sharks. Therefore, the rational 4 should not take such a risk, the hope of survival on the random selection of the 5, he only supports 3 to absolutely ensure their own life. Let's look at number 3. After the above logical reasoning, he will propose a Allocation Scheme (, 0, 0), because he knows that even if he gets nothing, and will vote for him unconditionally, then with his one vote, he will be able to win the 100 gold coins. However, if the allocation scheme of No. 3 is also obtained through reasoning on the 2nd, then he will propose the (, 0,) scheme. Because this scheme is relative to the allocation scheme on the 3rd, at least one gold coin can be obtained on the 4th and 5th sides, the rational 4th and 5th naturally feel that this solution is more advantageous for them and supports 2nd. Instead of having to exit 2nd, they will be allocated by 3rd. In this way, 98 gold coins can be taken from the fart on the second day. Unfortunately, no. 1 is not a fuel-saving Lamp. After some reasoning, I also learned about the allocation scheme of No. 2. The strategy he will take is to give up No. 2, and give No. 3 1 gold coins, and give No. 4 or No. 5 2 gold coins, that is, propose (, 0) or (, 2) the allocation scheme. Because the allocation scheme of No. 1 can obtain more benefits than that of No. 3 and No. 4 or No. 5, they will vote for No. 1, with the first vote of the first account, 97 gold coins can easily fall into the pockets of the first account.
Question 2
Smart question 2

Mr. S, Mr. P, and Mr. Q, they know that there are 16 cards in the drawer of the table: red peach A, Q, 4 black peach J, 8, 4, 2, 7, 3 K, Q, 5, 4, 6 blocks A, 5. Professor John picked a card from the 16 cards and told Mr. P about the number of cards and the color of the card to Mr. Q. Professor John asked Mr. P and Mr. Q: Can you tell from the known points or colors what the card is? So Mr. S heard the following conversation: Mr. P: I don't know this card. Mr. Q: I know you don't know this card. Mr. P: Now I know this card. Mr. Q: I know. After hearing the above conversation, Mr. s thought about it and correctly launched the card.
Excuse me: What is this card?
Solution:
In the first sentence, "Mr. P: I don't know this card ." We can see that this card has two or more colors, that is, a, Q, 4, and 5. If this card has only one color, Mr. P knows the number of points of this card, and Mr. P certainly knows this card. In the second sentence, "Mr. Q: I know you don't know this card ." We can see that the number of points of the color card can only include a, Q, 4, and 5. Only the peach and square match this condition. Mr. Q knows the color of this card. Only Mr. Q can make this assertion if the color of the peach and square includes a, Q, 4, and 5. In the third sentence, "Mr. P: Now I know this card ." Mr. P said, "Mr. Q: I know you don't know this card ." Judging that the color is peach and square, Mr. P knows the number of points of the card, and Mr. P knows the card. Therefore, if A is excluded, this card may be Q, 4, or 5. If the number of points for this card is a, Mr. P still cannot judge. In the fourth sentence, "Mr. Q: I know ." We can see that the color can only be square. If it is peach, after Mr. Q excludes a, it is still impossible to determine whether it is Q or 4. To sum up, this card is block 5.
Reference answer:
This card is square 5.

Smart question 3 (rope burning problem) rope burning problem
It takes an hour to burn an uneven rope from the beginning to the end. Now there are several ropes of the same material. How can I use the burning method to time the rope for an hour and 15 minutes?
Solution:
Burn a rope like this and burn it from the beginning to the end for an hour. It can be seen that it takes half an hour for both the head and tail to burn at the same time. At the same time, burn two of these ropes, one burning one end, one burning two ends; when the burning two ropes burn out, it will take half an hour, and it will take half an hour to continue burning one end of the rope; if one end of the rope is ignited at this time, it takes only 15 minutes.
Reference answer:
At the same time burn two such ropes, one burn one, one burn two; and so on one burn, the other cut off for backup. Mark as Rope 2. Find another rope, marked as Rope 1. It takes 1 hour for a burning rope and 15 minutes for two burning ropes. This method can be used for an hour and 15 minutes.

Question 4: Table Tennis
Assume that 100 table tennis balls are arranged, and two people take the ball into their pockets in turn to get 100th Table Tennis Winners. The condition is: each time you take the ball, you must take at least one, but not more than five. Q: If you are the first person to take the ball, how many should you take? In the future, how can we guarantee that you can get 100th table tennis balls?
Solution:
1. We may wish to use reverse reasoning. If there are only 6 Table Tennis balls left, and the other party gets the ball first, you will surely get 6th table tennis balls. The reason is: if he takes one, you take five; if he takes two, you take four; if he takes three, you take three; if he takes four, you take two. If he takes five, you take one. 2. We will separate the first 100 table tennis balls from the back to the front, and the other 6 Table Tennis balls from the back to the front. 100 cannot be divided into 17 groups. There are 4 groups in 1st, and 6 groups in the last 16 groups. 3. In this way, the first group of 4 will be completed, and then each group of 16 will let the other Party take the ball first and finish the remaining one. In this way, you can get the last one in the 16th group, that is, 100th table tennis balls.
Reference answer:
Take 4 first, and N for him. You take 6-N, and so on, to ensure that you can get 100th table tennis balls.
Exam extension:
1. Assume that 100 table tennis balls are arranged, and two people take the ball into their pockets in turn to get 100th Table Tennis Winners. Condition: at least two players can take the ball at a time, but no more than seven. Q: If you are the first person to take the ball, how many should you take? In the future, how can we guarantee that you can get 100th table tennis balls? (Take one first, N for him, and 9-N for you, and so on) 2. Suppose there are X table tennis balls arranged, and two people take the balls into their pockets in turn, the person who can get the X table tennis is the winner. Condition: At least y players are required to take the ball each time, but no more than z players are required. Q: If you are the first person to take the ball, how many should you take? In the future, how can we guarantee that you can get the X-th table tennis ball? (Take the remainder of X/(Y + Z) First, take n, and you take (Y + Z)-N, and so on. Of course, we must ensure that the remainder of X/(Y + Z) is not equal to 0)

Smart question 5 (drinking soda)
Drinking soda
1 RMB for a bottle of soda, and two empty bottles for a bottle of soda after drinking. Q: How many bottles of soda can you drink if you have 20 RMB?
Solution 1:
At the beginning, there were no problems with 20 bottles, and there were no problems with the next 10 and 5 bottles. Then, we divided 5 bottles into 4 and 1, and changed the first 4 empty bottles to 2, after drinking 2 bottles, change 1 bottle. After drinking, the remaining number of empty bottles on the hand is 2. Change these two bottles to 1 Bottle and continue to drink, after drinking, replace this empty bottle with one bottle of soda. after drinking the bottle, you can return the bottle to others. Therefore, the maximum number of soda drinks is: 20 + 10 + 5 + 2 + 1 + 1 + 1 = 40
Solution 2:
First, you can have a few bottles of soda at most for 1 RMB. Drink 1 Bottle and 1 empty bottle, borrow one empty bottle from the merchant, and change 2 to 1 bottle to continue drinking. After drinking, return the empty bottle to the merchant. That is, a maximum of two bottles of soda can be consumed for 1 RMB. Of course, you can drink up to 40 bottles of soda for $20.
Solution 3:
Two empty bottles for a bottle of soda, we know that pure soda is only worth 5 cents. Of course, you can drink up to 40 bottles of pure soda for $20. Of course, N yuan can drink up to 2N bottles of soda.
Reference answer:
40 bottles

Questions extended:
1. 1 RMB and 1 bottle of soda. After drinking, you can change two empty bottles to 1 bottle of soda. Q: How many bottles of soda can you drink if you have n RMB? (Answer 2n) 2. 9 cents a bottle of soda, after drinking three empty bottles for a bottle of soda, ask: How many bottles of soda can you drink if you have 18 yuan at most? (Answer 30) 3. 1 RMB for a bottle of soda. After drinking, four empty bottles change to a bottle of soda. Q: How many bottles of soda can you drink if you have 15 RMB? (Answer 20)
Wisdom question 6 (split gold bars) Split gold bars
If you ask a worker to work for you for seven days, the reward for the worker is a golden stripe. The golden bars are evenly divided into seven connected segments. You must give them a golden bar at the end of each day. If you only make two breaks, how do you pay for your workers?
Solution:
The essence of this question is digital representation. Two numbers, one or two, can represent three numbers: 1-3. The numbers 1, 2, and 4 can represent seven numbers (I .e., 1, 2, 1 + 2, 4 + 1, 4 + 2, 4 + 2, 2 + 1 ). The numbers 1, 2, 4, and 8 can represent 1-15 Fifteen numbers. And so on.
Reference answer:
Divide the gold bars into three portions: 1/7, 2/7, and 4/7. In this way, 1st days I can give him 1/7; 2nd days I will give him 2/7, let him retrieve me 1/7; 3rd days I will give him 1/7, plus the original 2/7 is 3/7; 4th I gave him the 4/7 yuan and asked him to retrieve the two 1/7 and 2/7 yuan gold bars; 5th days, and 1/7 days; 6th days and 2nd days; the 7th that was retrieved from him in 1/7 days.

Questions extended:
1. If you ask a worker to work for you for 15 days, the reward for the worker is a golden stripe. Gold bars are evenly divided into 15 connected segments. You must give them a golden bar at the end of each day. How do you pay your workers if you just make three breaks? (1/15, 2/15, 4/15, 8/15) 2. If you ask a worker to work for you for 31 days, the reward for the worker is a golden stripe. Gold bars are evenly divided into 31 connected segments. You must give them a golden bar at the end of each day. How do you pay your workers if you just make four breaks? (1/31, 2/31, 4/31, 8/31, 16/31) 3. If you ask a worker to work for you (2 ^ N)-1 day, the return to the worker is a golden stripe. Gold bars are evenly divided into 2 ^ n-1 segments. You must give them a golden bars at the end of each day, how do you pay for your workers? (1/(2 ^ N)-1), 2/(2 ^ N)-1), 4/(2 ^ N) -1 ),...) 4. why is RMB only the nominal value of 1, 2, 5, and 10? (Easy to find change. The ideal state should be 1, 2, 4, and 8. In real life, 10 hexadecimal notation is often used, SO 4 and 8 are changed to 5 and 10. As long as 2 has two digits, 1, 2, 2, 5, and 10 can represent 1-20 .)
Smart question 7 (weighing pills)
Weighing pills
You have four cans containing pills, each containing a certain weight. The contaminated pills are not contaminated with the weight + 1. How can I determine which jar of medicine is contaminated once?
Solution:
1. numbers 1, 2, 3, and 4 are given to four cans. 2. If only one jar is known to be contaminated: 1 on the first, 2 on the second, 3 on the third, and 4 on the fourth, subtract the standard weight of 15 pills. The result may be 1, 2, 3, 4. If it is 1, it is 1; if it is 2, it is 2; if it is 3, it is 3; if it is 4, it is 4; 3. If four cans may be contaminated or not, take one on the first, two on the second, and four on the third, take 8 pills on the 4th, and then deduct the standard weight of 15 pills. The result may be, or. If it is 0, four cans are not contaminated; if it is 1, it is the first tank; <br
If it is 2, it is 2; if it is 3, it is 1, 2; if it is 4, it is 3; if it is 5, it is 1, 4; if it is 6, can 2 and 3; Can 1, 2, and 3; can 8, can 4; Can 9, can 1 and 4; Can 10, can 2 and 4; Can 1, 2, and 4 if 11; can 2 or 4 if 12; Can 13, the four can are contaminated. (Step 3 actually includes step 2 .)
Reference answer: Same as above.

Questions extended:
1. There are 10 bottles of pills, some of which contain overweight pills. Ordinary pills 5g/tablet, overweight pills 6g/tablet, the number of pills per bottle is the same. Please use only one balance, once, to find out which bottles contain overweight pills. (Answer: Take 1, 2, 4, 8, 16, 32, 64, 128, 256, and 512 pills respectively) 2. There are n bottles of pills, some of which contain overweight pills. Ordinary pills 5g/tablet, overweight pills 6g/tablet, the number of pills per bottle is the same. Please use only one balance, once, to find out which bottles contain overweight pills. (Answer: retrieve 1, 2, 4 ,..., 2 ^ n grains) 3. 10 boxes, each with 10 apples, one of which has 9 Two/boxes, and the other has 1 kg/box. One scale is required to be used only once to find the box containing 9 or two. (Answer: Number, take out 1, 2, 4,..., 10, scale, minus, less n two is N)

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.