Facebook Interview Question
348 Interview Reviews |
Back to all Facebook Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Facebook:
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (5)
en.wikipedia.org/wiki/Newton's_method
Helpful Answer?
Yes |
No
Inappropriate?
Helpful Answer?
Yes |
No
Inappropriate?
1 of 1 people found this helpful
double sqrt_newton(double v) {
double x, nx = 1;
while (abs(nx - x) > 1e-9) {
x = nx;
nx = (v / x + x) / 2;
}
return nx;
}
Helpful Answer?
Yes |
No
Inappropriate?
double i = 0, j = num, mid;
if(j < 1) j = 1;
mid = (i+j)/2;
while(fabs(mid*mid-num) > 0.00001) {
if(mid*mid > num) j = mid;
else i = mid;
mid = (i+j)/2.0;
}
return mid;
}
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up



0 of 0 people found this helpful
by Interview Candidate: