[Summary] probability problem of Internet companies face questions probability of finishing

Reference blog

Bordery. Internet companies face the probability of finishing questions. Https://blog.csdn.net/bertdai/article/details/78070092

According to 10 Title + answer organize to show the way, easy to navigate.


Title 1-10

  1. How in the circle of radius 1 is randomly selected point?

  2. The probability of a wooden stick, cut into three pieces, composed of a triangle is how much?

  3. The number of throw throwing a six-sided dice, continuous cast until 6 thrown up, ask how much is expected.

  4. A barrel which has M white balls randomly remove a ball from the bucket every minute painted red (whether white or red are painted red) and then back, and asked the bucket painted red ball all the expected time?

  5. Do you have a sword. Each use of a gem, there is a 50% probability of success will let rise a sword, a 50% probability will fail. If the number of stages of the sword than 5, then the failure will be such that a level drop sword. If the sword of the series is less than 5, then fail to no avail. The question is: how much hope can make a gem of a level 1 sword rose 9?

  6. There are known rand7 () function returns a random natural number to 17, how to use this rand7 () configured rand10 (), 1 to 10 random.

  7. There are known randM () function returns a random natural number from 1 to M, how to use this randM () configured randn (), a random 1 ~ N.

  8. Given a random generator, the probability of generating 0. p, probability of 1 is 1-p, you now want to construct a generator, such that the probability of 0 and 1 which are generated 1/2.

  9. Given a random generator produces digital distribution is not clear, and now you want to construct a generator, making it produce probabilities of 0 and 1 are 1/2.

  10. Given a random generator, the probability of generating 0. p, probability of 1 is 1-p, a generator is configured such that it is configured 1,2,3 probability are 1/3; .... More generally, a generator is configured such that it is configured 1,2,3, ... n are the probability of 1 / n.

answer

  1. Method 1: \ (x = [-1, 1 ] \) and \ (y = [-1, 1 ] \) surrounded randomly selected squares that, if the points falling within the circle was the desires; if not in the inner circle, random until the re-election to date.
    Method two: a randomly selected angle from [0, 2 * pi), randomly selecting a point in the radial direction. But not uniformly in the radial point selection, the selection probability proportional to and away from the center of the circle, so as to ensure a random point within the circle are uniformly distributed.

  2. Three sides are \ (X \) , \ (Y \) and \ (. 1-XY \) , which satisfies \ (0 <X <. 1 \) , \ (0 <Y <. 1 \) , \ (0 < 1-xy <1 \) condition, and then drawing to obtain a probability of 1/2.

  3. Probability of throwing occurrence 6 for $ P = \ FRAC {. 1} {6} \ (, \) P (K) = \ FRAC {. 1} {6} ^ {K-. 1} * \ FRAC {. 5} {6 } \ (meet geometric distribution, desirably \) E = \ FRAC. 1 {{}} = P. 6 $.


Topic 11-20

  1. A bucket of white balls, each of the black ball 100, the ball is now taken according to the following rules:
    I, every two balls out from inside the tub;
    II, are removed if two different color requirements, it is then placed in a black ball;
    III, if the two different color is taken to seek, then placed on a white ball.
    Q: The last bucket of only one black ball probability is how much?

  2. 10 people go out to play, the set time is 10 minutes, and everyone reached within that time, the probability of a uniform distribution, independent of each other, then the last one is the most likely time of arrival?

  3. Known random number generation function F () returns 0 is the probability of 60%, a return probability is 40%. The f () find a random number function G (), so that the probability of 0 and 1 return to 50%, can not be generated using conventional random library functions.

  4. 100 people line up, each person can only see the color of their own people before the hat (assuming that only black and white), each person had to guess the color of their own hat, one can only say, wrong is dead, people can listen to to answer before the people and whether die. I ask what the policy say the least people dead.

  5. 54 cards, were divided into three groups, the size of the king with a bunch of probability?

  6. Buy drinks, three bottle caps can change, what to buy 100 bottles of beverages, you need to buy a minimum number of bottles?

  7. There is a very big input stream, without the large memory may be stored, and the input only once, how to obtain the m random probability recording medium from this input stream.

  8. On a highway, in 30 minutes to see the possibility of a car is 0.95, then the probability of seeing in 10 minutes a car is how much? (Assuming that the probability of excessive car is constant)

answer

  1. 0 = black ball, white ball = 1, then the subject is described internal array Yihuo calculation result is 0, that is to say only a black ball 100% probability.

  2. Finally, the probability of a person arriving at the n-th minute was: $ (1/10) \ times (n / 10) ^ 9 $, when n take 10 maximum probability.

  3. Generating two numbers, the probability of 01 and 10 are equal, with two direct mapping 0 and 1, 00 or 11 if directly discarded to continue the experiment.

  4. At least 99 people can live.
    Finally, a person can see all the information front, starting from the last one, as if in front of [white] even the odd black newspaper black (their own half of the survival probability), even if the front of the black [white] the odd newspaper White ( they have half the chance of survival);
    for the penultimate people, with the last reported individual black, for example, see [if] the odd black and white odd he must also reported that white is white, even if the black even see [ white] is also reported to own a certain black black;
    for the penultimate 3 people, with one person reported last down 2 black black newspaper, for example, see [if] the odd black and white even he must also reported white white, If you see [even] black and white even then it must also reported that black is black; it goes on.

  5. $ P (on the same pile king size) = 3 * P (i-th stack King | Wang stack in the i) * P (i-th stack Wang) = 17/53 * 3 * 1/3 $.

  6. Ternary tree structure, \ (^ 3 ^ 0. 1 + 3 + ... + n-3 ^> 100 \) , solve for \ (n->. 4 \) , the visible part of the layer 3 and the back part of the fourth layer is required to own Buy, and a portion of the second layer are all layer 3 can be obtained before the exchange. X is provided a fourth layer, there is
    $ x + x / 3 + 27 -x / 3 = 100 - (3 ^ 0 + ... + 3 ^ 2) $
    solve for x = 60, so a total buy \ ( + ^. 3. 3-X X /. 3 = 67 \) .
    Another idea: 100 individuals, who make a set of 3, a total of 33 groups, more than one person, i.e. 100 / == 3 33, 100 bottles of water, 3% 3 == for a bottle, i.e. a set of required buy two bottles (as the need for a start), so the obvious conclusion, 100/33 * 2 + 1 = 67

  7. Calculated for each time data rand [0,1), maintaining a small size m heap root, and finally the front m large data records.

  8. Traps is not within the first 10 minutes 30 minutes 10 minutes and is arbitrary. See disposed within less than 10 minutes for car probability p, then see the vehicle in 30 minutes probability \ (P ^. 3 \) , then there is
    $ p ^ 3 = 1 - 0.95 $
    last request \ (1-p \ ) can be. The answer is 63.16%.

Guess you like

Origin www.cnblogs.com/lvjincheng/p/11361461.html