Backend Engineering Interview Notes After Two Years of Experience

Backend Engineering Interview Notes After Two Years of Experience Originally published in Chinese on 2022-01-26; this English edition preserves the original scope and technical context. Byte One Way coding: For an array, pick one element with a single traversal, where each element is chosen with equal probability (from a global perspective, each element has a probability of 1/n) For the i-th element, its probability of being chosen in the i-th round is 1/i From then on, once an element is picked, it gets eliminated; for the i+1-th round, its elimination probability is 1/(i+1), making its survival probability 1 - 1/(i+1) Finally, the probability of each element being chosen is as follows. The first 1/i represents it being chosen on the i-th occasion, with the rest representing it being left in subsequent rounds. ...

January 26, 2022 · 6 min · Zhengyu Chen