Pergunta de entrevista da empresa Meta

In the coding round, I was asked to solve a standard sampling question. Sample some items based on their weights.

Resposta da entrevista

Sigiloso

11 de out. de 2024

Convert weights to probabilities, then arrange these probabilities in a line. Sample a random number between 0 and 1, and finally use binary search to find the interval that this sampled number lies in