Somehow, despite failing to answer either of the Meta phone screen’s 2nd questions; I’ve been able to successfully make it through and get onto the onsites! Took this interview yesterday, and got word I am moving on!
The leetcode struggle never ends!
1st question I got – fucking easy; retrieve the maximum value at each level of a binary tree. Either do a DFS or a BFS, and store the values in a dictionary and compare them to the value at the level. OR do a DFS and simply store in an array with some variable that tracks the level you’re at and what levels were previously looked at. This one is cake – only thing I got mixed up on here, was not asking if negative values would be present in the binary tree; which was simply fixed up by updating my .get() method to have a -infinity value instead of -1.
2nd question, disgusting – not on Leetcode FB tagged top 50 or top 100; it was one the interviewer chose themselves; imagine you’re receiving a constant stream of characters, as you receive them; determine how you’d print a specific list of words when they pop up! i.e. if opabobafett was part of our stream; and the words we’d want to print out are in the list [opa, boba, bobafett], print those specific words out. As we can see in the example stream, there are overlapping characters, so…. it makes it a little complex. I didn’t get to code this one out AT ALL, I simply described my thought process and how I’d even go abotu doing it. Luckily, I know of tries! So I said each word should be stored within a TrieNode, and the end of the word should be identified in some manner. To determine that the word is ready to be printed, we store a list of pointers. Each character that we receive, we check if it’s in the root TrieNode, and if any of the pointers in our list can be moved forward. We remove each pointer as we print it out, so we don’t constantly waste storage! Luckily the interviewer was convinced enough, although tbh I barely know the implementation of a Trie!
Onwards to the next 3-4 rounds! These are not my only interviews, anymore.. but.. still my most desired! Amazon, Microsoft, Zoom, anywhere, take me in!