Bloomberg LP Interview Question
Software EngineersCountry: United States
Interview Type: Phone Interview
Adapting the binomial options pricing model and compound probability we should be able to return the sum of f(1) over 30 trials to give us equal probability in returning [0..29]
The probability is going to be .5^29
public static int f29() {
int start = 0;
int randomPick = 0;
while (start <= 29) {
randomPick += f1();
}
return randomPick;
}
- xuzhiwen1024 June 29, 2015