Unlock All Tasks
Learn by doing is the most effective way to master engineering skills. Real Dev provides a variety of real-world projects from backend like nodejs, Django to frontend React and HTML. Start working today and really master the skills.

Task: Typeahead Backend


Typeahead or autocomplete is a common feature that people come across on websites. For example, when you are searching on Google, you will notice a word populates before you finish typing.

For this task, we'll implement the backend of a simple typeahead system. You will be provided with a list of names and their popularities.

You're asked to write up a typeahead backend system using prefix-tree order by popularity.

For example, if the data provided is {"John": 21, "James": 43, "Joanna": 13, "Ja": 3} and a user queries j, then it returns [{"name": "James": "times": 43}, {"name": "John": "times": 21}, {"name": "Joanna", "times": 13}, {"name": "Ja", "times": 3}]. Note, the search is case-insensitive.

In addition, an exact match would take precedence despite of the popularity. For example, a search keyword ja would return [{"name": "Ja", "times": 3}, {"name": "James", "times": 43}] since Ja has an exact match.


Microservice, Backend


Problem Solving

Unlock all the tasks

Nobody here yet, solve it now to get on the board!