[UPDATE] Got to the next round of interviews.
Hello, everyonea!
Yesterday I had my Phone Screen interview. I was pretty confident, I recapped almost everything: Binary Trees, BSTs, Graphs, DP, Greedy, even Math&Geometry, and I learned a little bit about Tries: a concept not well-known to me.
I was expecting to get maybe like a medium-hard DP or something related to Graphs, but destiny said I should get Tries. Was I unlucky to get this kind of question? Or it's just my fault for not preparing very well on this one topic?
I have done the brute force approach, maybe with some minor bugs (because of the emotions). Then I started to describe how a Prefix Trie would help us and then wrote a solution for that. Only after the interview I realized I made some mistakes afterwards, on some base case conditions (it was a recursive solution), but the main steps of the algorithm are there and there was not enough time left. For sure I'm gonna get rejected for this, but at least I expect them to appreciate the thought process.
Question:
You are given a pattern consisting of alpha characters and [] (square brackets). Anything outside of [] is literal, anything inside [] are alternatives (pick exactly one). Return all strings from a list of strings that match a given pattern. The pattern changes for every call, the list of strings stays the same and can be preprocessed.
Example:
pattern: "tele[op]ho[bnm]e"
list: ["cat", "dog", "telephone", "telephonepole", "tele", "telehoe", "teleophobnme"]
result: ["telephone"]
What do you think about this problem? Also, shouldn't I have received two questions as usual? I'm stressed ...


