Google Interview Questions

Google used to be notorious for asking brain-teaser style questions during their interviews. Questions like "How many golf balls can fit in a school bus?" and "How much should you charge to clean all the windows in seattle?" Luckily, Google has finally banned their engineers from asking the difficult and silly questions. We can instead prepare for an interview at Google like we would at any other company: with lots of practice!

Despite Google banning the brain-teaser questions, the interviews can still be quite difficult. But, if you know what kinds of questions to expect, you can properly prepare and maximize your chances of getting the job offer you have always wanted. There are three primary types of questions that are asked at Google:

**Phone Interviews**will focus on basic problem solving and data structure questions.**Coding Interviews**are whiteboard focused sessions that will ask harder data structure and algorithm questions.**System Design Interviews**will be about high level system architecture and are saved for the most experience candidates.

Practice Questions

XOR Linked List

An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous node. Implement an XOR linked list; it has an add(element) which adds the element to the end, and a get(index) which returns the node at index.

Monte Carlo Circle

The area of a circle is defined as πr^2. Estimate π to 3 decimal places using a Monte Carlo method.

Intersecting Lists

Given two singly linked lists that intersect at some point, find the intersecting node. The lists are non-cyclical.

*k*th-last Element

Given a singly linked list and an integer *k*, remove the *k*th last element from the list. *k* is guaranteed to be smaller than the length of the list.

Edit Distance

The edit distance between two strings refers to the minimum number of character insertions, deletions, and substitutions required to change one string to the other. For example, the edit distance between “monday” and “sunday” is two: substitute the “m” for “s”, substitute the “o” for “u”.

Given two strings, compute the edit distance between them.

Given two strings, compute the edit distance between them.

Need help solving these questions? Want more practice questions?