Facebook | Phone | Design data structure for wildcard search
Company: Facebook
Role: Software Engineer (Android)
Interview Stage: Phone Screen
Location: Menlo Park
Year: 2020
Original Post Content:
Status: Experienced, Pursuing MS in CS
Position: Software Engineer (Android)
Location: Menlo Park
Date: April 27, 2020
Technical phone screen (45 minutes):
- Technical questions
- What is ANR?
- How will you prevent ANR?
- Algorithm question: 1 question
- Given a list of strings, find a match that could include wildcard character as well
- Question: Implement these two methods below
- setup({"foo", "bar", "baz"})
- isMember("foo") // return true
- isMember("garply") // return false
- isMember("f*o") // return true
- isMember("**") // return false
After that he gave 5 minutes to ask questions and that was a wrap.
Result:
Approached with HashMap initially, but needed a complexity of O(n), hence attempted with Trie, but ran out of time. Any help appreciated in solving this problem.