Bloomberg LP Interview Question
Software EngineersCountry: United States
Interview Type: In-Person
public static double pow(int x, int y) {
if(y == 0) return 1;
if(x == 0) return 0;
if(y < 0) return 1/pow(x, Math.abs(y));
String[] ind = Integer.toString(y).split(".");
int indd = Integer.toString(y).indexOf(".");
if(ind.length > 1 && Integer.parseInt(ind[1]) > 0){
int denom = 1;
while(indd++ < Integer.toString(y).length()-1) denom *= 10;
return pow(x,Integer.parseInt(ind[0] + ind[1]))/pow(x,denom);
} else {
return x*pow(x, y-1);
}
}
Looking for interview experience sharing and mentors?
- aonecoding May 03, 2017Visit A++ Coding Bootcamp at aonecode.com.
Given by experienced engineers/interviewers from FB, Google and Uber,
our ONE TO ONE courses cover everything in an interview including
latest interview questions sorted by companies,
SYSTEM DESIGN Courses (highly recommended for people interviewing with FLAG)
ALGORITHMS (conquer DP, Graph, Greedy and other advanced algo problems),
and mock interviews.
Our students got offers from G, U, FB, Amz, Yahoo and other top companies after a few weeks of training.
Welcome to email us aonecoding@gmail.com with any questions. Thanks for reading.