ARCHIVE FILE
A Facebook interview
They do not begin with a flight. They begin with a conversation that is pretending not to be a test.
Someone gauges interest. Are you actually willing to move. Independent contributor, not manager, not yet. There is a frontend core team that works on React, with a weekly rotation so you do not fossilize on one surface. There is the larger Facebook frontend. There is Instagram. There is Parse. Manager can wait. The first question is not "can you code". It is "which of these rooms would you even sit in".
Then California or London.
California is six thousand people and an H1B. More teams to choose from, less of the research-and-dawn feeling. London is three hundred people, no visa, more startup-y, more R&D. I keep turning the two over as if they were different jobs. They are the same company. They are not the same life.
After interest, four technical questions. After that, the thing they call a coding challenge and mean as a day of your life. Eight to ten hours, they say. No time limit. They want your best work, which is a polite way of saying they will look at how you live with a problem once the clever first hour is over.
The problem is a calendar.
You get a list of events. Each event is a start and an end, counted in minutes past nine in the morning. {start: 30, end: 90} is half past nine until half past ten. The day runs to nine at night, in a box 620 pixels wide and 720 pixels tall. You must implement one function in the global namespace:
function layOutDay(events) {}
The rules are the part that looks simple on paper. No two events may visually overlap. If two events collide in time they must share a width, call it W, and W has to be as large as it can be without breaking that invariant. That last sentence is the whole interview. You can place rectangles. Anyone can place rectangles. The invariant is what you do when three meetings share an hour and a fourth only kisses the end of one of them.
I wanted to do it in JavaScript with no framework at all. There are plenty of improvements to be made. The layout of collisions proved harder than I thought.
You start by putting each event in the first column that will have it. If the column is occupied at that time, you try the next. If there is no next, you invent one. Then you walk the collisions again and shrink everyone in a colliding set to the same W, and you push them sideways so the day still reads as one day and not a pile. The last pass is the honest one. Events that never collided get to be wide. Events that collided with fewer neighbours than the busiest column can recover some of the wasted space. If you get that wrong, the calendar looks fine until you add the ugly case, and then it lies.
That is the work. Not React. Not Instagram. A Tuesday that will not overlap a Wednesday.
What comes after, if the calendar holds, is two coding interviews of forty-five minutes each, then an interview in San Francisco, then a hiring interview. I have not sat those rooms yet. I have sat this one: a long, quiet argument with a handful of intervals, and a choice I have not made between a visa and a smaller office.
I do not know yet whether I want six thousand people or three hundred. I know what the calendar taught me. The hard part is never the event. The hard part is the event that is already there.