Pergunta de entrevista da empresa Pinterest

How would you implement an autocomplete method to return first n suggestions(input: search query, stored word/phrase suggestions, n) each suggestion has a word/phrase accompanied by a score Follow up. How would you extend this solution to optimize on memory/performance, if input is scaled up.

Resposta da entrevista

Sigiloso

20 de fev. de 2024

naive solution: manually sort suggestions and return follow up: implemented trie, i hadn't implemented one from scratch before and as a result came up slow.