Facebook Interview Question
347 Interview Reviews |
Back to all Facebook Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineering New Grad at Facebook:
Calculate x ^ y in O(log n)
See more for this Facebook Software Engineering New Grad Interview
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (2)
1 of 1 people found this helpful
if(y == 0) return 1;
double d = power(x, y/2);
if(y%2 == 0) return d*d;
else return x*d*d;
}
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up



1 of 1 people found this helpful
by Interview Candidate: