← Questions

Top-k prefix suggestions filtered by department

0
GleanCodingLast asked Sep 2026

A coding interview question asked in Glean's coding round, last asked Sep 2026. It tests tries, heaps and memory.

A service keeps a static list of suggestions, each a tuple (ngram, department, score). Given what the user has typed so far and their department, return the k best suggestions: those whose ngram starts with the query and whose department…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Glean · Coding · Last asked Sep 2026Live coding, usually two rounds

What it tests

tries · heaps · memory

Your code and the AI tutor open when you unlock this question.