Implement a Stateful Search Autocomplete Session
Company: Pinterest
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Technical Screen
Overview: Implement a stateful autocomplete session that ranks matching historical sentences by frequency and lexicographic order. Process each keystroke, commit completed nonempty sentences, update future suggestions, and keep results independent of the initial input order.