How to Prepare for a Technical Interview at Facebook

Since starting the computer science lab, I've had the chance to work with many students interested in working at Facebook. As a result, I've acquired a keen interest in their hiring process. Similar to Google and Amazon, their interview "loop" is well known for being a lengthy, detailed experience. I recently visited their new Seattle office for an informal talk on how they suggest candidates prepare for a technical interview. This essay provides tips, notes and suggestions. 

 

Behavior Points

Attending the interview event at Facebook, my goal was to brush up on the latest techniques and fine-tune my approach when coaching others. I enjoyed learning their process is graded on three aspects. The Behavioral Phase is geared towards getting to know the candidate. This includes strengths, weaknesses and goals. What stood out was their emphasis on finding individuals who can demonstrate how they've recovered from a failed project or a project in jeopardy. These events reveal more about a candidate's attitude, behavior and outlook than merely providing the standard boilerplate responses. Facebook seeks individuals who can demonstrate the popular fail-fast mentality and are not afraid to take a chance. 

 

Best Foot Forward

The highlight was seeing a live demonstration of their Technical Interview process in which a presenter/developer white-boarded a solution in front of a 100+ person audience. In an actual 5-6 hour Facebook interview, roughly half the time will be spent completing coding challenges. As a result, it was emphasized that candidates use the time to put their best foot forward. 

At Facebook, candidates are given approximately 45 minutes to solve each coding question. Given the time constraint, they suggest making an impression by asking the right questions, then proceeding to implement a brute force approach before optimizing your design. Solving challenges using specific API's or language features are also accepted, as long as you're able to explain in detail how they perform. To demonstrate, let's revisit a code challenge on creating an algorithm to detect unique characters in a String. The signature is as follows:

 
//challenge: write a function to determine if an input String (e.g element) contains all unique characters.  


func isStringUnique(element: String) -> Bool {
    //code goes here..
}
 

Like this article? Get more content like this in the iOS Computer Science Lab.

 

As with most code, there are many possible approaches. In the article, I review how it can be solved by applying a brute force approach, then proceed to optimize the code so that it runs in linear time - O(n) or better. What wasn't discussed was solving it purely with native Swift API's or language features. Interestingly, this seemingly concise solution also satisfies our requirement:

func isStringUnique (_ s: String) -> Bool {
    return s.count == Set(s).count
}

System Design

Beyond the coding interview phase, I was pleasantly surprised Facebook placed so much emphasis in Systems Design. It was suggested that candidates take time to review and study this facet of software development. Although good systems design also requires significant domain knowledge to be successful, interviewees can practice beforehand by understanding the needs for data management, security, hardware, scalability, tradeoffs, bottlenecks and beyond. The result? Succeeding in systems design challenges require a different set of skills than code development. Primarily, being able to communicate your ideas through the use of diagrams. As such, this was a great reminder to revisit standard Unified Modeling Language (UML) standards.