Hacker News new | comments | show | ask | jobs | submit login

I interviewed with Facebook in March for a front-end developer role. It was an insulting experience. The tech screen was with some low-level engineer. The first(and only question before I hung up on him) was to write a function in javascript to return the square root of a number.

My answer in 15 seconds: var sqr = function(e){ return Math.sqrt(e); }

Easy enough. But no, he wanted a function that demonstrated an algorithm to find the square root. Ok... I said. I spent a minute trying to salvage some odd details from high-school algebra and basically came up blank. I was thinking, well this isn't going to look good on me. I readily admit to him that my knowledge of figuring out square roots by hand is a rusty, having been out of high school for 12 years(even though in retrospect, this was something we were never really even taught anyway). But surely this guy, who is screening me for my ability to do front-end coding, will move on and start asking me some hard problems about javascript, css, cross browser problems, etc. No.

We spend the next 6-8 minutes with him circling back on his square root problem. I tried a couple more times to answer this question that is completely unrelated to the job I'm interviewing for. Finally, I get so fed up with this moron that my internal ticker clicks over and I realize, "Even if I get this job, I'm going to be dealing with these kinds of nazel-gazing engineers every single day. Not an environment I want to be in." I thanked him for his time, and he acts surprised and says "Are you sure? After everything it took to get to talk to me?". Yes, I say. I'm quite sure. >Click.<

I realized a long time ago what kind of people these are. When I was growing up, the garbage truck would come by on Tuesdays and Thursdays. When we first moved to the neighborhood, we would put our garbage out by the mailbox and some days it would be picked up and sometimes not. We would complain and nothing would change.

After a few weeks, I was standing out front when they came by. I noticed that everyone had their trash bags on the right side of their mailboxes. That morning, I had done that as well. But some new neighbors down the street had put theirs out on the left side of their mailbox. The truck comes by, grubby guys grabbing/throwing, grabbing throwing. All the garbage gone, except for the neighbors. The next time, I purposely left ours on the left side. Didn't get picked up that day.

So that was the day that I realized these guys had their Line In The Sand. It was Their Way or the Highway. They had a really crappy job. Probably crappy lives at home because they're garbage men. This was Florida, not NYC. There's no glamor or high-pay there. This was the one place where they were the kings, the arbiters of Pickup Or Not. This was the one point of control over their lives they could influence, and they grabbed onto with both hands and some toes.

So this little middling engineer at Facebook had his Line too, in the form of a square root function that Had To Be ANSWERED! "You shall not cross!" He exclaims internally. I'm positive he was quite satisfied with himself after I hung up. Some self congratulation at keeping another peasant out of the castle halls. Kind of like the junk yard dog on a chain behind the fence. Smug in barking and keeping away the kids, but still chained to his dog house.




It's a common problem when hiring the academically brilliant (and recently out of college) - they're more focused on inane details than getting the job done.

I was once part of a college team where nothing ever got done because people couldn't agree on using git vs. svn. Bravo.


It doesn't have anything to do with the relationship to academia -- I've had plenty of time on both sides of that fence, and in my experience there are far more people in industry who are obsessed with tiny, arbitrary measurements of intelligence. Academics tend to be quite practical when it comes to hiring, and there are tons of relatively "dumb" people working in the research trenches.

Age may play a role. These sorts of questions are the geek equivalent having the shiniest back in the forest. But given that tech companies almost universally strive to create a culture of "we're special," it seems inevitable that you're going to get arbitrary rites of initiation into the various geek tribes.


I got asked the same SQRT question from FB (this was over the phone mind you). Not sure if I should give the the name of the interviewer. I bet it was the same guy. Anyway, the interviewer asked me to go to a FB site where we can collaborate and he can see what I am coding. He asked me this question and did not budge away from it. It was just ridiculous. For the life of me, I tried various different methods, even going to wikipedia but it was extremely complicated to code that up in a short period of time. We spent half the interview on this question. I decided to go work for Google, a much better company, instead.


Yes, I had that exact same experience. It was a form they use that lets them see as you type. You have to be logged into your FB account, then they look up your name. After it was over, I ended up writing back to the recruiter who setup the manager and told them about this experience and how unprofessional it was. Kudos for getting a job at a company that has a real business.


My guess is that he wanted to see if you could think your way towards some kind of algorithmic approach. I think his biggest mistake was not moving on to something else after a minute or two. I've used these sorts of questions in interviews before, but usually just as a small part of the overall interview. I prefer to ask questions that relate more to what we're actually doing (a real project, a real technical challenge we recently faced, etc.)

I wonder if FB has formal standards for its interview process, or if they just grab someone and say "Hey, go interview this guy."


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...

(I really do wonder if this is what the Facebook interviewer wanted to hear, but I am doubting it.)


Root-finding algorithms, or more generally iterative optimization and numerical solution of equations, isn't something to be sneered at. Sure, it's a front end position, but the ability to do this is something I'd want to know if I were interviewing you, too.


Many square root methods have been devised, notable among them the Newton method, devised by the guy that invented calculus..

How does front-end design work significantly overlap with this? I would wager that one could quiz the best CSS/Javascript gurus in the world and not a single one would know, nor care.


I agree 100%. I still count not being able to answer that question as a deficit in my own knowledge and have done work post-that to be able to answer those types of questions in the future. It doesn't change my opinion about the experience, unfortunately.


It's not just the numerical analysis aspect: what if the interviewer was looking for knowledge of functional programming (given Javascript's support for first order functions)? Given that square root via Newton's Method is one of the first "wow this is really neat" things that struck out to me when I read SICP:

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html...


haha the amusing thing is that he himself likely only looked up the newton-raphson method ten minutes before phoning you. sadly that is the case for many of these mensa-test mental masturbation questions...if you had asked your interviewer the day before, they too would have drawn a blank.

you would think it would suffice to just tell him, yeah, i am aware that the newton-raphson method exists, and what it is supposed to do.


You can also use binary search to approximate the square root of a number.


You can also use a lookup table, an AJAX call to a square root web service, using the canvas and drawing appropriate geometric shapes then measuring, or, if you have a bit of free time, implementing code which has commercial value, accepting money for it, and then going to Radio Shack and buying yourself a calculator with a square root key.

But personally, yeah, I'd use Math.sqrt.


well the point is, and i think this is the original poster's point...questions like this are not relevant to what facebook is doing, and even if it is, its the kind of thing you look up.


In Facebook's defense (I have no affiliation with FB, and in general am not a big fan of them), they probably weren't looking for somebody to whip out Newton's method, but rather just binary search.

Everyone who says "this question is completely irrelevant" isn't completely right. This question would be completely irrelevant if they were exclusively looking for a "fancy" square root finding technique. However, binary search is a pretty basic algorithm - the trick here is to recognize that such a basic algorithm can be applied to a seemingly unrelated problem. If Facebook is testing to see if people can connect different parts of their knowledge (square root function is strictly increasing, something that everyone knows to be true at least intuitively, combined with the fact that binary search can then be used in such a situation), then it's a reasonable question to ask. Maybe not for a front-end developer though.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: