Thursday, April 25, 2024

Preparing For Google Coding Interview

Don't Miss

The Google Phone Interview

Prepare for Your Google Interview: Coding

For the phone screen, you are interviewed by at least one Google employee who provides you with a coding question. You share a Google document with the interviewer and use it to write code for the question asked by the interviewer.

Protip: Coding in Google Docs sucks, but if you update your preferences it can make your life 1000x better. Learn how to do that here.

This interview will focus on your ability to produce code without an IDE . Typically, the question asked will be one that can be solved by a brute-force solution, and then progressively improved upon.

The phone interview is about 30-45 minutes. Assuming you did well, the Google recruiter will reach back out to you to give you the next steps if they decide to move along with you.

Dont be disappointed if they ask to do a second phone interview. Thats totally normal if they dont feel like they were able to adequately assess you the first time and doesn’t have any bearing on your later interviews.

Faqs On Google Tech Interviews

Q. Are coding rounds more important than design rounds at the Google interview?

For junior software positions, coding rounds are more important than design rounds. For senior developer and managerial positions, design rounds and behavioral rounds hold more weight in hiring decisions.

Q. What type of behavioral questions are asked at Googleâs technical interview?

Behavioral questions asked at Googleâs interview are typically around the following topics:

Process Of Coding Interview At Google

The coding interview process at Google is not entirely different from that of other tech companies. As the first step of your interview, a Google engineer will offer you an online interview where you can expect some very difficult technical questions. The questions here can also involve questions based on Data Structures and Algorithms.

After your first round of interview, your second interview will be an on-site interview where you will be interviewed with 4-6 interviewers. Here, each interviewers comments are kept confidential from other interviewers, so you can rest assured that no interviewer will get the first impression of your performance in previous rounds.

Not all interviewers have a defined structure of questions to ask you. So, they can ask whatever they want, but the first question is mostly based on what you wrote about yourself in your resume. So make sure everything you wrote about yourself in your resume is true and you can explain it.

After all the interviews, your performance is divided into four categories:

  • Analytical Skills
  • And then, you get an overall score between 1 and 4. This score is assigned to you by the comments about you from your interviewers to the recruiting committee. The recruiting committee does not include any of the interviewers.

    Don’t Miss: Basic Phone Interview Screening Questions

    Preparing For The Interviews

    I am listing all of the resources that I found helpful for interview preparation, not just for Google but in general.

    • Geeks for Geeks: GFG is one of the best places to practice because it includes articles along with questions and detailed answers with an explanation of the time and space complexities.
    • LeetCode: This is my personal favorite as it includes company-specific questions that help a lot. Also, I personally find the quality as well as the number of questions pretty nice when compared to all the interview prep sites I have practiced on to date.
    • Cracking the Coding Interview: Apart from the above two resources that majorly focus on coding, this book also gives a good guide on how to impress an interviewer, by constantly clarifying the questions and optimizing your solutions. An interview is not just about problem-solving, it is about how you approach the problem and solve it from scratch.
    • Codeforces: CF contests help a lot in improving ones algorithmic thinking, coding speed as well as accuracy which are the key ingredients for acing an interview.

    Phase : How I Chose My Learning Resources

    GitHub

    I know everyone thinks there is a secret magic bullet out there. Some blog, video, resource, tutorial, podcast, PDF cheatsheetsomethingthat will unlock the entire secret and make us instantly learn things.

    Nope.

    Ill bang on about this till the day I die information is a commodity.

    Learning is hard, but its made much harder because there is too much free information.

    We all fall into the trap of thinking there is some missing piece of information. There isnt.

    Why? Because no matter where you live, what language you speak, what color your eyes, skin, or hair are, what gender you identify with all resources are going to teach you things that work. Theyre all the same at a very fundamental level.

    They have to be, because thats how computers work.If you and I write an identical function in JavaScript or Python or Java, we are going to get identical results. Thats how computers work theyre deterministicalgorithms.

    But life is most decidedly not deterministic. Identical effort, grades, skill, intelligence will not produce identical results.

    Again, I had to teach myself tolearn. I had to teach myself to shift my attention away from resources/blogs/websites/courses and put my attention on building solid mental models, identifying relevant skills, drilling down on concepts rather than code implementations, applying what I already knew in new ways, reasoning, problem solving, and communicating my reasoning while I reasoned.

    Recommended Reading: What Makes A Good Interview

    The Google Onsite Interview

    The Google onsite round involves speaking to a number of Googlers. Usually this will include four to six separate interviews, including one lunch interview.

    Generally, you will be asked primarily coding interview questions and potentially one or two system design questions as well.

    The more experience you have, the higher proportion of system design and topic-specific questions you can expect to be asked. Google rarely asks any system design questions to engineers with less than 5 years of experience.

    Each interviewer collects feedback on how well you performed during the one-on-one interview with you. This feedback is collected by each interviewer independently as to eliminate cross-chatter and biases between your interviewers. If you felt as if you performed subpar in one of the interviews, that baggage stays there and does not follow you into the next interview.

    Determine If The Number Is Valid

    Given an input string, determine if it makes a valid number or not. For simplicity, assume that white spaces are not present in the input.

    4.325 is a valid number.

    1.1.1 is NOT a valid number.

    222 is a valid number.

  • is NOT a valid number.
  • 0.1 is a valid number.

    22.22. is NOT a valid number.

    Try it yourself

    def is_number_valid:  #TODO: Write - Your - Code  return False

    The solution algorithm works by maintaining counts of left_braces and right_braces. The algorithm can be seen below.

    left_braces count: 0right_braces count: 0if left_braces count is less than n:  add left_braces and recurse furtherif right_braces count is less than left_braces count:  add right_braces and recurse furtherstop recursing when left_braces and right_braces counts are both equal to n

    Recommended Reading: What Are The Top Interview Questions

    Google Coding Interview Process: Unique Aspects

    There are a few unique aspects of the Google coding interview process and their selection, this includes:

    • You will perform all coding in Google Docs for remote sessions. Make sure you are practicing and can write code in this. For onsite interviews, Google will give you a Chromebook to use, or in some cases, it may just be a whiteboard.
    • They have a hiring committee that will review your application. So it isnt always about the interviewer, but their recommendations are required.
    • Google will grade you from 1-4 on all your interviews. If you dont get at least a 3, you wont pass the coding interview process.
    • Google will review you as a person based on the Google hiring criteria, which is:
    • Cognitive Ability

    How you solve problems. If you are regurgitating learned information with no real understanding or ability to think outside the box, that is not ideal. Google wants to know you can come up with multiple solutions and implement the best one.

    Can you take on a leadership role for specific projects? If you are a follower only, then Google may not want you. Instead, you should be discussing times you lead a project or team.

    • Role-related knowledge

    Google hires on a team basis. So you should have specific knowledge required for the team you are applying for. They also want to know you can grow as the team grows and evolves. So a track record of changes and continued learning is essential.

    Have Questions For The Interviewer

    How To Ace The Google Coding Interview – Complete Guide

    Some of mine :

    • How large is your team?
    • What does your dev cycle look like? Do you do waterfall/sprints/agile?
    • Are rushes to deadlines common? Or is there flexibility?
    • How are decisions made in your team?
    • How many meetings do you have per week?
    • Do you feel your work environment helps you concentrate?
    • What are you working on?
    • What do you like about it?
    • What is the work life like?
    • How is the work/life balance?

    Recommended Reading: How To Start An Interview As The Interviewer Example

    Software Testing : Get Started With Software Testing Types

    As software becomes more advanced, software testing must evolve with it. Software testing is how we check if the actual software product matches requirements and runs properly once distributed.

    Knowledge of different testing methodologies can help build your resume and land a high paying jobs like a quality assurance engineer in top FAANG companies.

    Today, well look at these modern methodologies and how they lead to more polished software products.

    Heres what well cover today:

    Learn Selenium testing framework fast

    Get hands-on experience with the most popular automation testing framework, including interactive examples and insider tips.

    You May Like: How To Interview A Realtor When Selling A Home

    Delete Node With A Given Key

    We are given the head of a linked list and a key. We have to delete the node that contains this given key. The following two examples elaborate on this problem further.

    Example

    Input: head = , key = 5Output: Explanation: You are given the second node with value 5, the linked list should become 4 ->  1 ->  9 after calling your function.

    Try it yourself

    def delete_node:  #TODO: Write - Your - Code  return 

    First, we have to find the key in the linked list. Well keep two pointers, current and previous, as we iterate the linked list.

    If the key is found in the linked list, then the current pointer would be pointing to the node containing the key to be deleted. The previous should be pointing to the node before the key node.

    This can be done in a linear scan and we can simply update current and previous pointers as we iterate through the linked list.

    Read Also: How To Get Ready For A Job Interview

    If You’re Comfortable With Git

    Create a new branch so you can check items like this, just put an x in the brackets:

  • Fork the GitHub repo:https://github.com/jwasham/coding-interview-university by clicking on the Fork button.

  • Clone to your local repo:

    git clone [email protected]:< your_github_username> /coding-interview-university.gitcd coding-interview-universitygit checkout -b progressgit remote add jwasham https://github.com/jwasham/coding-interview-universitygit fetch --all
  • git add .git commit -m "Marked x"git rebase jwasham/maingit push --set-upstream origin progressgit push --force
  • What Interviewers Are Looking For

    Learn to Code and Help Nonprofits

    We are not simply looking for engineers to solve the problems they already know the answers to we are interested in engineers who can work out the answers to questions they had not come across before.

    The above thing is the most important thing the interviewer will be looking for also read the below points

    • Interviewer have generally a mindset while taking the interview that if he/she can work along with the candidate in his/her daily to a job or not so do not show signs of arrogance or ego while giving the interviews.
    • Interviewers will check whether youve used the suitable data structures and algorithms while implementing the code or not.
    • Interviewers will notice the approach that how you optimized the solution, your knowledge about the choice of programming language, your coding speed, any corner cases that you missed and how you analyzed time and space complexity.
    • They will check how you communicated your thought process to solve a specific problem in a logical way. They will also check if you were able to catch the hint and was able to proceed with the solution or not.
    • If the candidate was open to new ideas? if the candidate was flexible in his/her solutions?

    Tips:

    Helpful Links:

    You May Like: Where To Shop For Interview Clothes

    System Design Scalability Data Handling

    You can expect system design questions if you have 4+ years of experience.

    • Scalability and System Design are very large topics with many topics and resources, sincethere is a lot to consider when designing a software/hardware system that can scale.Expect to spend quite a bit of time on this
    • Considerations:
    • Distill large data sets to single values
    • Transform one data set to another
    • Handling obscenely large amounts of data

    Algorithmic Complexity / Big

    • Nothing to implement here, you’re just watching videos and taking notes! Yay!
    • There are a lot of videos here. Just watch enough until you understand it. You can always come back and review.
    • Don’t worry if you don’t understand all the math behind it.
    • You just need to understand how to express the complexity of an algorithm in terms of Big-O.
  • Implement a vector :
  • Practice coding using arrays and pointers, and pointer math to jump to an index instead of using indexing.
  • New raw data array with allocated memory
  • can allocate int array under the hood, just not use its features
  • start with 16, or if starting number is greater, use power of 2 – 16, 32, 64, 128
  • size – number of items
  • capacity – number of items it can hold
  • at – returns item at given index, blows up if index out of bounds
  • insert – inserts item at index, shifts that index’s value and trailing elements to the right
  • prepend – can use insert above at index 0
  • pop – remove from end, return value
  • delete – delete item at index, shifting all trailing elements left
  • remove – looks for value and removes index holding it
  • find – looks for value and returns first index with that value, -1 if not found
  • resize // private function
  • when you reach capacity, resize to double the size
  • when popping an item, if size is 1/4 of capacity, resize to half
  • O to add/remove at end , index, or update
  • O to insert/remove elsewhere
  • contiguous in memory, so proximity helps performance
  • space needed = * size of item, but even if 2n, still O
  • Don’t Miss: Data Structures To Know For Coding Interviews

    My Guide To Preparing For The Google Technical Interview

    TODO: Upvote my original post and other good answers on Quora. The following is my answer to the question “How should I prepare for my Google interview if I have 1 month left?”

    With over ten years of programming experience and a CS degree, it took me about a month and a half of daily practice to get ready for the interview. Ready, for me, is ambitiously defined as the ability to tackle almost any technical interview question in 30 minutes or less and reach an optimal solution. The following is based upon what I did to prepareyour mileage may vary.

    Ingredients:

    Directions:

    1) Learn as much as you can about the Google interview process

    Just like an incomplete understanding of a technical question will ruin you in the actual interview, misinformation will derail your preparation leading up to it. I learned this the hard way when I failed at my first attempt after emphasizing brain teasers over studying algorithms and data structures.

    Once you have a solid foundation, Id recommend following up by reading CTCI. Particularly focus on chapters 5 and 6 entitled Behavioral Questions and Technical Questions.

    Reverse A Linked List

    How to: Work at Google Example Coding/Engineering Interview

    Reverse a singly linked list. See the example below.

    Input: 1-> 2-> 3-> 4-> 5-> NULLOutput: 5-> 4-> 3-> 2-> 1-> NULL

    Try it yourself

    def reverse:  reversed_list = head  #TODO: Write - Your - Code  return reversed_list

    Lets take a look at the iterative approach.

    If the linked list has 0 or 1 nodes, then the current list can be returned as is. If there are two or more nodes, then the iterative approach starts with two pointers:

    • reversed_list: A pointer to already reversed linked list.

    • list_to_do: A pointer to the remaining list.

    Then, we set reversed_list-> next to NULL. This becomes the last node of the reversed linked list.

    For each iteration, the list_to_do pointer moves forward. The current node becomes the new head of the reversed linked list. The loop terminates when we hit NULL.

    Recommended Reading: What To Answer In An Interview

    Some Interview Tips To Help You Get Ahead

    These proven tips will help you make the most of your 4-week study plan!

    • Time your study sessions and take regular breaks â at least one break every 45 minutes, to avoid burnout and fatigue.
    • Practice whiteboard coding as it is super important from an interview perspective
    • Avoid distractions during your preparation. Problem-solving is an intense skill that needs rigorous effort and dedication
    • Solve a minimum of 2-3 problems every day for the 4-weeks leading up to your interview
    • Focus on identifying power patterns in problems and apply them while solving new problems
    • This is perhaps the only way to tackle challenging and tricky problems in the interview
    • Practice mock interviews with hiring managers from FAANG+ to polish your interviewing skills

    Preparing For The Google Interview

    In order to improve your chances of acing the Google interview, and to prevent you from having to spend another 6-months waiting to reapply, you should definitely stack the odds in your favor and prepare.

    But how do you prepare effectively? There is no shortage of websites like HackerRank, LeetCode, ProjectEuler, TopCoder, etc. that serve as technical interviewing problem farms.

    Sure, you could spend your time grinding through every single problem on LeetCode, but is the massive time investment really worth it? Is there a more efficient way you could be preparing?

    Everyone has a finite amount of time and energy, and therefore using both resources as effectively as possible is an important factor in optimizing for both. Deliberate, consistent, and targeted practice is integral to successfully navigate the Google interview.

    Read Also: What Are Questions Interviewers Ask

    More articles

    Popular Articles