Just finished onsite interview with Google for Mountain View location. No level was mentioned as it was a generalist interview.
Round-1:
Given a dictionary of words (sorted lexicographically) and a prefix string, return all the words that start with the given prefix.
Solved this by doing a binary search on the input and char comparision.
Follow-up: what if the input is not sorted. I mentioned that we would implement a Trie, but I was not fully able to finish the implementation within the time. Could be penalized for this? idk.
Round-2:
Given a n-ary tree, print the nodes in the required format.
Follow-up: given the printed string, make the tree and return the root.
Example:
1
/ | \
2 3 4
| / \ |
5 6 7 8
|
9
print the output in this format (append a dash "-" to each node value and keep adding dashes for each level)
-1
--2
---5
--3
---6
---7
----9
--4
---8Round-3:
Given a list of pair of runners [a,b] where a beats b, print all the runners in the correct finsihing order. Simiar to course prerequiste problem
Implemented the solution with DFS, but later realized I hadn't checked for cycle in the graph. May be a minus point there.
Round-4:
Googlyness round. Ususal behavioral questions and some based on past experience and projects.
It was a decent experience overall. Interviewers were all super friendly. I am waiting for feedback. fingers crossed.