Pregunta de entrevista
Entrevista de Strategist
-
Goldman Sachshow to make rand 5 from rand 7 generator. expected no. of rolls b4 all the faces of dice u get
Respuestas de entrevistas
2 respuestas
▲
2
▼
X1 ~ Geometric(1) X2 ~ Geometric(5/6) X3 ~ Geometric(4/6) ... You want to find out E[sum{x_i}]
Anónimo en
▲
0
▼
def tosstillunique(n): tosses = [] while ( len(np.unique(tosses)) != n ) : new_toss = np.random.randint(0,n) tosses.append(new_toss) #print(tosses) return len(tosses) n = 6 num_samples = 10**5 samples = [ tosstillunique(n) for i in range(num_samples)] u = np.mean(samples) this gives 14.7
python sim en
Añadir respuestas o comentarios
Para publicar un comentario sobre esto, inicia sesión o regístrate.