3 ms·
That would actually be a good question to ask, but probably for an entirely different reason than facebook meant. This is how I would ask this of a Javascript p
by strlen 18y ago
That would actually be a good question to ask, but probably for an entirely different reason than facebook meant. This is how I would ask this of a Javascript person:
I'd immediately tell you to use Newton's method, what Newton's method is and (if you didn't have a college degree) what derivative is.
Then we'd go through the exercise of doing it for square root and then I'd see if you could the fact that Javascript has support for first-order functions to implement it similarly to how it's done in SICP:
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1.7 http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html...
(I really do wonder if this is what the Facebook interviewer wanted to hear, but I am doubting it.)