Spotify Interview Question

given n samples from a uniform distribution [0, d], how to estimate d?

Interview Answers

Anonymous

Jul 30, 2015

d=2*E(X)

15

Anonymous

Apr 1, 2015

it should be max[x_1, ...,,x_n] by using maximum likehood estimation

15

Anonymous

Mar 7, 2016

Given k measurements x_1, x_2, ... x_k, the probability density function for x is P(x) = { 1/d for x in [0,d], 0 otherwise }. d* = argmax{d} (product{i = 1:k} P(x_i) ) = argmax{d} (sum{i = 1:k} log (P(x_i)) ) = argmax{d} (sum{i = 1:k, d >= max (x_i)} log(1) - log(d) ) = argmax{d} (sum{i = 1:k, d >= max (x_i)} -log(d) ) = max(x_i)

4

Anonymous

Aug 24, 2017

d=2Avg(X) / d=2Median(X)

3

Anonymous

Jan 26, 2018

The expectation of max(x_i) is (n-1)d/n, therefore an unbiased estimator would be n*max(x_i)/(n-1)

1