2014 Meituan campus recruitment R & D test (Harbin Station), 2014 Harbin

Source: Internet
Author: User

2014 Meituan campus recruitment R & D test (Harbin Station), 2014 Harbin

1,
Question: a pile of coins, a robot, if it is reversed, it will turn positive, if it is positive, it will throw once, after an infinite number of times, the ratio of seeking positive and inverse.

Analysis: if the ratio of front coins in a certain stage is p, the ratio of the front coins is 1-p. After the next flip, the p part is divided into the front of p/2 and the back of p/2, the negative side of 1-p is all positive. When it tends to be balanced, the ratio of the two positive and negative values should be equal, that is, p/(1-p) = (p/2 + (1-p)/(p/2 ), get p = 2/3.
More directly, the front and back sides of the flip are equal, that is, p = p/2 + (1-p), and p = 2/3 is obtained directly.

2. Probability question: the product of an automobile company, factory a accounts for 40%, factory B accounts for 60%, the defective rate of product A is 1%, and the defective rate of product B is 2%, now I want to find a defective car and ask if it is possible to produce.
40% * 1%
3,
There are 100 bulbs, the first round of all the lights, the second round of each two lights out one, that is, 2nd, 4th, and so on, in the third round, change the number to a multiple of 3: electric lights, 3rd, 6th. If the light is on, turn it off. If it is off, light it, wait until 100th rounds. Q: How many bulbs are bright after the end of 100th?

Answer:
If the last light is on, it must have been switched to an odd number of times (0th times are all switched off ).

First, let's take a look at the six lights. The number of switches is 1st (wheel), 2nd, 3rd, and 6th.
It can be seen that if a round of 6 is switched, the round number must be an integer of 6, that is, the approximate number of 6. Because the approximate number appears in pairs, the number of times that 6 is switched off is an even number.
However, for the total number of segments such as 4 and 16, since they all have an approximate number k, so that the square of K is equal to the total number of segments, the number of times it is switched off should be an odd number, because K can only be counted once.
Therefore, the answer to this question is only 1-full records, which is on.

That is, the 10 lights of 81,100, are on.

* Note:
Total number of vertices: If a number is the full square of another integer, this number is called the full number, which is also called the number of vertices.

4. Flip the linked list. Give a linked list and a number of k, such as the Linked List 1 → 2 → 3 → 4 → 5 → 6, k = 2, then 2 → 1 → 4 → 3 → 6 → 5, if k = 3, after Flip 3 → 2 → 1 → 6 → 5 → 4, if k = 4, after flip 4 → 3 → 2 → 1 → 5 → 6, implemented by program

 

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.