Source: Asked for a data scientist position at a technology startup in financial services sector in London
max_num = x
for i in x[1:]:
if i > max_num:
max_num = i << Expected number of times this expression was evaluated
Calculate the expected number of times the expression max_num = i was evaluated, given that array x was taken from a uniform random distribution.