Search⌘ K
AI Features

DIY: Suggest Relevant Sentences

Explore how to design and implement a suggestion system that predicts endings of input strings by utilizing historical sentence data and ranking. Learn to handle continuous input streams, update suggestions dynamically, and return the top relevant results based on prefix matching. This lesson helps you understand practical search engine features and apply efficient algorithms to solve real-world problems.

Problem statement

Design a system that will guess how a specific string will end. This system will make suggestions by tracking the history of strings that it has seen before. The input() function should take a continuous stream of input, which will end when "#" is found. Each call to the ...