Search⌘ K
AI Features

DIY: Suggest Relevant Sentences

Explore how to design a suggestion system that predicts sentence completions by tracking input history and ranking suggestions. This lesson teaches you to implement functions that continuously take input streams and output the most relevant suggestions, enhancing skills in real-time search and autocomplete features.

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 ...