I want to share my entire experience related to the Google interview process.
After two calls with a recruiter, I was able to have two phone interviews. In the first one I had to solve two problems.
First Phone Interview
Even that the phone call was for some reason noisy, I was able to go through the interview. The first problem was pretty simple and the second one was a follow up of the first one but harder.
 Valid Parentheses

Remove Invalid Parentheses
After the first phone interview they asked me to do a second one to check if I was a candidate for the onsite interviews.
Second Phone Interview
This have been the best interview experience I’ve ever had. The interviewer was really nice, gentle and excited about his job and about the interview.
The problem was pretty simple.
Given two lists, return the elements of the first list that are not in the second list. And also return the elements on the second list that are not in the first list.
For example if you have the lists:
l = [1, 2, 2, 4]
l2 = [1, 2]
// Result
l = [2, 4] // In this case 1, 2 are on the second list
l2 = []
I did this problem using a HashMap to have a count of the elements, and then just return the remaining ones on the HashMap an N number of times. The HashMap was declared as <Integer, Integer>
where the first integer is the element, and the second one how many times it appeared on a list.
My solution to this was something like this:
import java.util.*;
class Main {
public static void main(String[] args) {
List<Integer> l1 = new ArrayList<Integer>();
fill(l1, new int[]{1, 2, 3});
List<Integer> l2 = new ArrayList<Integer>();
fill(l2, new int[]{5, 6, 1});
HashMap<Integer, Integer> hmA = mapList(l1);
HashMap<Integer, Integer> hmB = mapList(l2);
compareList(hmA, l2);
compareList(hmB, l1);
System.out.println(convertToList(hmA));
System.out.println(convertToList(hmB));
}
public static List<Integer> convertToList(HashMap<Integer, Integer> hm) {
List<Integer> l = new ArrayList<Integer>();
for (Map.Entry<Integer, Integer> pair : hm.entrySet()) {
for (int i = 0; i < pair.getValue(); i++) {
l.add(pair.getKey());
}
}
return l;
}
public static void compareList(HashMap<Integer, Integer> hm, List<Integer> l) {
for (int n : l) {
if (hm.containsKey(n)) {
hm.put(n, hm.get(n)1);
if (hm.get(n) == 0) {
hm.remove(n);
}
}
}
}
public static void fill(List<Integer> l, int[] arr) {
for (int n : arr) {
l.add(n);
}
}
public static HashMap<Integer, Integer> mapList(List<Integer> l ) {
HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
for (int n : l) {
if (hm.containsKey(n)) {
hm.put(n, hm.get(n)+1);
} else {
hm.put(n, 1);
}
}
return hm;
}
}
That was the only problem on that interview. After I few days I received a mail requesting my availability for the onsite interviews.
Onsite Interview
Two weeks after the second phone interview I went to the onsite interviews. During this stage you have the chance to meet 6 google employees. 4 are technical interviews, 1 is behavioural interview, and the other one is not an interview, is just hanging out with some employee to have a meal.
During the “meal interview” you’re not being evaluated, and your chaperone is not taking notes. The paper that you see, is just a record of which questions were already asked to you so another person avoid that question.
I will share each of my interviews here, alongisde with the feeling of the interview. Also I won’t post the specific question that they asked me to solve, but I’ll put something close or similar to it.
First Onsite Interview
This was really, the worst interview experience in my life. A rude person, that was truly mad becuse he/she had to come early to work just to make the interview. This was exposed by the interviewer itself before the interview, and the rudeness and angry were constant during the interview.
The intervieweer yelled at me when I was asking clarification questions, and he/she even wasn’t paying attention to my questions, that leaded to a missunderstand of the following up problem, and he/she did not notice it until I was repeating my clarification questions at the end of the interview.
The first question during this interview was: Given a number N, generate an N by N board in which each column need to be filled with an unique random number in a range. This range is given by the current column and grows in the range of 20 for example:
 You have an 3 by 3 grid
 The first column only can have numbers from 1 to 20
 The second one from 21 to 40
 The third one from 41 to 60
Also you can assume that for practical reasons, the first index of the matrix is equivalent to a column and the second one to the row.
The following question was: Modify your previous function to receive a number M. That M is the number of unique grids of N by N that you need to return.
I was’t able to come for a solution the following uo question because the interviewer told me something and when I was claryfing and telling what I was going to do, he/she did not noticed that I was solving another problem. And also because all the clarification were answered in a really mean way.
Second interview
This was another great interview, the person this time was really clear about the problem, nice and relaxed about the situation.
The problem given was: Given an array, and a number K, you need to sl¡plit that array in K parts and return the sum of the smallest subarray.
The most similar problem I could find in leetcode is Split Array Largest Sum
For this problem I went for a recursive approach, but from the beggining I told the interviewer that I feel that there is a dynamic programming solution for the problem.
Third interview
This was another nice interview, but a weird one. In this interview, I was asked to put in a mathematical formula the procedure. So I lost a lot of time writing the formula exactly as the interviewer wanted it.
The problem was simple:
You’re given an NXM matrix, and you can travserse this matrix only by moving Up, Down, Left or Right. Also alongisde with the matrix you’re given a list of coordinates, that indicates the path of a message that needs to go from the starting element of the list of coordinates, to the last one.
You can asume that the given path is a valid path that does not have cycles or repeated points.
Each element on the matrix has the probability of failure to pass the message to that node.
Your task is to find the probability of success of the entire path.
4th interview
This is really specific, and I can’t found a way to describe the problem with other words. This interview was nice, and hard. Basically the intervieewer wanted to see If I could come up for a solution for that problem, and found the base caso that could solve all the problems.
I could not finish the code for this problem, It was kind of complex.
Results
After two weeks of wait, I received a message from the recruiteer telling me that the interviews went well but they did not feel that I was a fit for the team that I applied.