Live data from Hacker News

Get that job at Facebook (2012)

facebook.com

171–174 of 174 posts

Re: Get that job at Facebook (2012)

#171

Earlier quoted context omitted.

Hm, I clicked all around the site and wasn't able to get a .php in any of my URLs. They were all "clean" or "pretty" URLs, as I would expect from a profesional, large web app. I wonder why we have different URLs.

https://www.facebook.com/home.php

When I click "Home," I just get https://www.facebook.com/. I wonder why you get the php urls.

Re: Get that job at Facebook (2012)

#172

Earlier quoted context omitted.

Hm, I clicked all around the site and wasn't able to get a .php in any of my URLs. They were all "clean" or "pretty" URLs, as I would expect from a profesional, large web app. I wonder why we have different URLs.

The redirect url for outgoing links has .php at the end.

Hm, I looked a lot of the links in my news feed and they were all direct.

Re: Get that job at Facebook (2012)

#173
post #40

I interviewed at Facebook (a while ago - they were still on University Ave). This article is a pretty accurate description of the interview process that I remember, but could apply equally well to technical interviews most places. The "fit" category is fairly vague, but a better description of it (and what I think about when interviewing candidates) is "how would I feel if I had to stay late fixing a live site issue…

I'm sometimes amazed at how many people have problems with what I think are simple questions.

Simple is not the same thing as relevant.

Re: Get that job at Facebook (2012)

#174

Earlier quoted context omitted.

In that case, it's probably most space efficient to place each new window next to an already visible window or at an edge of the screen. So keep a list of possible candidate positions. Each of these positions represents either an edge of the screen or a position directly above/below/to the left/to the right of an existing window. You will need to calculate different offsets for each of these circumstances to generate…

You know, for people who have taken graphics classes, this seems like a much easier question because they know about AABB trees. That is the problem at the heart of the question. Also, your idea about candidate positions is wasteful. Just invert the tree so that it contains empty space instead of full space. Then, on insert, remove from the tree.

That is an example of a theoretical solution that may be overkill in practice, especially if you are stuck in JS. Unless you send window positions back to the server for analysis.

And can you code an AABB tree on a whiteboard? :-)

One could try placing the new window at (100x, 200y) for integer x,y, and check for intersection each time with all the existing windows. 3600 overlap tests in the worst case, but you get huge benefits in practice by hinting the location of the last new window.

Optimize a bit by sorting lists of windows by x and y, so you can binary search for the few candidates to overlap test, and you are down to about 1000 window checks. You miss some cases if windows are very maliciously aligned off grid, but you can mitigate that by using a slightly finer grid.

Or test the 8 neighbors (edges and corners) of each existing window (if any), as it is nearly impossible for available space to be not one of those positions.

(You can compute the next window position after the previous window creation or move, so there is no latency when rendering a new window.)

Post reply on HN