Round 1: Phone Interview
Questions: Word for word this question, just that the result was not the earliest time when everyone to becomes friends, but for a group of people, given in a set, to become friends The Earliest Moment When Everyone Become Friends.
Candidate's Approach
Solution: Union find, or I guess you might be able to do it with multiple DFSs.
Interviewer's Feedback
No feedback provided.
Round 2: Onsite 1
Questions: This question, but worded a bit differently. It was asking for the shortest unionized path from what I remember.
Candidate's Approach
Solution: 1 BFS from Alice, 1 BFS from Bob, 1 BFS from Destination, to find minimum distances to all nodes starting from Alice, Bob, Destination, loop through nodes and find the minimum sum aDistances.get(node) + bDistances.get(node) + dDistances.get(node).
Interviewer's Feedback
No feedback provided.
Round 3: Onsite 2
Questions: I haven't seen this question yet. Nodes in a tree are represented as:
class Node { int pIndex; String value; }
The tree itself is given to you as Node[] tree, where the pIndex (parent index) of every node at i is smaller than i (pretty much means that the parent of each node is before the node itself in the array). You need to implement a method "void eraseNodes(Node[] tree, Set
Candidate's Approach
Solution: I gave a solution where I have a switchTimes integer that I increment when I find a node that is at an index inside toErase or when the pIndex of the node is in toErase. I also add the node's index to toErase if only its pIndex is inside toErase. For nodes whose index is not in toErase and their pIndex is also not in toErase, I just swap them with index i - switchTimes. The interviewer pointed out that you also need to update the pIndex of non-deleted nodes, you would do this with a map, but I didn't have enough time to code that part out.
Interviewer's Feedback
No feedback provided.
Round 4: Onsite 3
Questions: You are given an MxN integer matrix where matrix[i][j] = elevation at that position. From every position you can move up/down/left/right and your goal is to return the path from (0,0) to (m-1,n-1) where the maximum elevation of the path is minimal. The maximum elevation of a path is the maximum elevation found on that path. Very similar to Swim in Rising Water.
Candidate's Approach
Solution: I gave a solution with Dijkstra where I push elements of the form {i, j, curMaxElevation} to a PriorityQueue, where for every neighbor the nextMaxElevation = max(curMaxElevation, matrix[i][j]), and return the curMaxElevation when we are at position (m-1,n-1). The interviewer said the solution is good, just that we don't need to push the curMaxElevation to the pq, but rather have just {i, j} on the pq, and on each iteration extract the {i, j} with the minimum matrix[i][j] from the pq. I coded that too.
Interviewer's Feedback
No feedback provided.
Round 5: Googliness
Questions: Usual questions similar to Googliness Frequently Asked Questions.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Recommendations
- A solid fundamental of DSA knowledge is definitely needed. You can get this by solving and really understanding the concepts of Leetcode 150/Neetcode 150. I wouldn't start interviewing without this.
- Study problems that were given before by the company. Leetcode discuss section helped me a lot and even though I have solved 500+ questions at the time of writing this, I am not sure I would have come up with the solution for some of these problems. For example, I didn't study UnionFind before this, or I probably wouldn't have known the answer for the triple BFS question.
- Be a genuinely nice person in the interviews, maybe make the interviewer laugh, listen to their feedback, say a "nice to meet you" in the beginning and so on. This gives you a cheat code where the interviewer will start rooting for you.
Overall, I hope I did enough. Hope that I don't need to be absolutely perfect to get an offer. I will post the feedback when I get it. Now I really need to take a break for a while because whenever I type the letter 'n' in my browser's search bar neetcode comes up before Netflix and I don't like that.
Good luck to you all! :D