Interview Frontend Virtual Onsite at Google

I’m sharing a Google Onsite interview experience from the end of last year.

Position

The position was for a Frontend full-time job switch.

Questions

The interview consisted of 5 rounds: 3 frontend, 1 algorithm, and 1 behavioral. Originally scheduled for 2 frontend rounds and 2 algorithm rounds, but due to an unexpected event with one algorithm interviewer, there was a switch resulting in frontend questions for me.

  1. Algorithm: The question was essentially LC128: Longest Consecutive Sequence.

  2. Frontend: Given an API: myFunction(args, onSuccess, onFail), the internal implementation was unknown. Then, you were asked to implement a retry function with a signature like this:

  3. Frontend: This question mainly tested querying DOM nodes using JavaScript. Implement the querySelector(selector) function.
    3.1. Given an id selector, e.g., “#myNode”, find and return that node.
    3.2. Then given a class selector, e.g., “.myClass”, find and return the collection, noting that when searching for a class, nodes may not be unique, so return an array.
    3.3. Next, given a combination selector, which is the combination of the above id and class “#myNode .myClass”. Here, you also need to return a collection. This also tested traversing the DOM Tree as you need to ensure “.myClass” is a descendant of “#myNode”. The interviewer was not as friendly as the previous ones, quite serious, would interrupt me, and nitpick on some concepts or terms. It was quite stressful, so be mentally prepared.

  4. Behavioral
    This round felt relatively easy as I often encounter these situations at work, and I hadn’t prepared for such questions before the interview. I basically spoke as things came to mind. For those without work experience, I suggest preparing a bit, think about how to answer, don’t appear too aggressive or too humble.
    4.1. Describe a challenge you faced at work and how you resolved it? (Problem-solving ability)

4.2. Have you ever had differing opinions with teammates? How did you handle it? (Teamwork ability)

4.3. Have you led a team before? (Leadership)

  1. Frontend: Observer Pattern. Provided some interfaces, then implement the update function upon receiving an event, along with a simple test. It was something like that; I don’t remember the details clearly, sorry. The Observer Pattern is a classic Design Pattern; I recommend understanding it. I assumed I was familiar with the EventEmitter pattern (the flux mechanism) and didn’t look into it. Although similar, in hindsight, it did waste a lot of time. I probably didn’t explain many things clearly enough.

Brief Summary

Google’s interviews indeed focus on abilities, rarely using exact questions, usually variations. Their interview style is to start with a simple question and gradually increase the difficulty. Their goal is to challenge you to solve problems collaboratively with the interviewer, assessing your communication and problem-solving abilities. Of course, the main focus is on your own analysis and problem-solving, with the interviewer assisting. So, make sure to articulate your problem-solving approach and communicate with the interviewer.