I had a friend who was graduating from my university and he mentioned that Oracle is hiring SDEs in Seattle, WA, and gave me the LinkedIn contact of the manager. I messaged him with my resume and he set up a phone interview for me.
Phone Interview
You have a text file with different types of log messages. Give me the K most frequently occurring log messages. [Top K Frequent Elements from Leetcode]
The trick is to use a min-heap rather than a max-heap for this question which will allow you to save space. For instance, if you were inserting all the log messages into the max-heap, you will have to insert all the N log messages. Whereas by using a min-heap, you could limit the size of the min-heap to K.
I first went with the max-heap and gave the min-heap as a better solution.
Onsite 5 interviews with a mixture of coding, behavioral, and system design questions.
Round 1
You have a matrix containing 0s and Ds where 0 can be thought of as a file and D as a database. Find the shortest distance for each 0 to reach the closest D [01 Matrix from Leetcode].
I provided the brute-force solution first which is to iterate over the entire matrix if the current cell is 1. We then see the neighbors and if there are 0s we find the relative distance and update if its lesser than the previous value. This would be O (n4) time complexity. The better solution would be to use BFS and start from 0s and update the distance of 1s on the path. I struggled with the BFS solution but was able to code it out in the final minutes.
Round 2
Implement a Binary Search Tree Iterator [Binary Search Tree Iterator from Leetcode].
Since this is a standard tree question, I didn't have any trouble solving this. I first went with doing an inorder traversal and stored the whole result in an array. We can then iterate over the array. The optimized solution is to do a controlled recursion on the tree which can act as an iterator. The official LeetCode solution explains this method clearly.
Round 3 (Lunch with Manager)
After finishing lunch, we had a small coding exercise.
Calculate the angle between the hour hand and minute hand. I had recently discussed this problem with a friend and hence was able to give the solution.
Round 4
You have a list of unreserved telephone numbers. Implement a getRandom() to get a random number. Have a reserve() function which takes a number as input and assigns customer the number. Time complexity is critical [Insert Delete GetRandom O(1) from Leetcode].
I have practiced a similar question like the one above and was able to solve it.
Design a centralized logging system that collects logs from 100 servers. Enrich the customer user experience by not spending a lot of time in searching for logs.
We had only 15 minutes for the system design problem and most of my answers were structured around the concepts from [System Design Primer from Github].
Round 5
Given a string s, find the longest repeated or duplicated substring [Longest Duplicate Substring from Leetcode]. This was a hard question and I was able to come up with a brute-force solution only. We touched upon the concepts of Trie and Rabin-Karp algorithm and the interviewer was happy.
Behavioral Questions
Oracle Cloud Infrastructure (OCI) has a list of values that are very similar to the AWS Principles. Having a story of how you have carried out or displayed the said value should be enough. The bartender aka bar raiser also asked me some detailed questions from my projects that I did during my Masters.
The manager reached out by the end of the week and informed me that I will be getting the offer.