Machine Coding Round
Problem Statement:
Your organization has started a new tech blog with interesting tech stories and you’re responsible for designing and implementing an in-memory search engine, supporting the search functionality on the blog content.
Requirements:
- It should be possible to create a dataset in the search engine.
- It should be possible to insert documents into a given dataset. Each document is simply a piece of text.
- It should be possible to search through documents for a search pattern in a given dataset.
- It should be possible to order the search results
- Search Pattern: Initially search pattern would be sequence of words, but can be extensible for different search patterns:
- Sequence of words containing words
- Sequence of words containing words maintaining the order
- Sequence of words containing words maintaining the order in sequence(substring)
- Ordering Logic: Initially ordering pattern would be latest published article, but can be extensible for different search patterns:
- Ordering can be recently published articles
- Ordering can be recently updated articles
- Ordering can be recently searched articles
- Ordering can be done based on Author.
Personal Feedback
- Interviewer wanted to get the O(1) fetch during query.
- Interviewer also wanted not to make too much memory consumption (during initial preprocessing of the blog content).
- The 30-40 minutes discussion went for Algorithmic/DSA related discussion on how to store/fetch the documents.
- For effecient read/write queries discussion went around map, sorting, hashing, hash collisions, array manipulation, 2 Pointers, Trie implementatiton - which wasn't really scope of this interview. Is this normal?
- Got only 20 minutes for actual coding, probably didn’t do much to clear the round.
- The interviewer seemed very inexperience on how to navigate the interview.
Any hint on how to approach this problem?
Comments (2)


