MEDIUMasked at 18 companies

Search Suggestions System

A medium-tier problem at 65% community acceptance, tagged with Array, String, Binary Search. Reported in interviews at UBS and 17 others.

Founder's read

Search Suggestions System hits your OA and you freeze on the data structure choice. UBS, DoorDash, Coursera, and Citadel all ask this one. The problem looks simple: given search products and search words, return top 3 results sorted by frequency then lexicographically. But the naive approach tanks on large inputs. You need to pick the right tool fast. Trie? Binary Search? Heap? If you blank mid-assessment and can't decide which path, StealthCoder solves it invisibly in seconds, leaving you time to code cleanly.

Companies asking
18
Difficulty
MEDIUM
Acceptance
65%

Companies that ask "Search Suggestions System"

If this hits your live OA

Search Suggestions System is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trap is thinking one data structure solves everything. A Trie gets you fast prefix matching, but ranking results by frequency and alphabetical order requires a second pass and careful sorting logic. Binary Search can work if you sort the product list first, but then you're doing extra work. The real pattern: index products by prefix inside a Trie, store frequency and name together, then at query time collect all matches and sort by frequency descending, then lexicographic ascending. Most candidates either overengineer with a Heap or underdeliver with a naive loop. The 65% acceptance rate reflects how many trip on implementation details, not the algorithm itself. StealthCoder matters here because the trick isn't obvious from the problem statement alone, and a live OA gives you no room to backtrack once you've committed to the wrong structure.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Search Suggestions System recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Search Suggestions System interview FAQ

Why is this medium and not easy if it's just sorting?+

It's not just sorting. You must handle multiple queries efficiently. A naive approach that sorts the entire product list per query will time out. You need either a Trie to narrow the search space upfront or Binary Search with careful indexing. That optimization jump is what pushes it into medium territory.

Is Trie the only right answer?+

No. Trie plus sorting per query works. Binary Search on a pre-sorted product array also works. Heap is overkill. The companies asking this (DoorDash, Coursera, UBS) accept multiple approaches. Pick whichever you can implement cleanly under time pressure.

What trips up most people in the live assessment?+

Sorting logic. Many code the frequency sort correctly but forget that ties break by lexicographic order, not insertion order. Others build a Trie but don't store metadata (frequency, name) efficiently in the nodes, forcing them to rebuild during query answering.

Does this problem test string manipulation or data structures?+

Both, but data structures is primary. The string aspects (prefix matching, lexicographic comparison) are straightforward. The hard part is choosing and implementing the right structure under pressure to handle 10,000 products and 10,000 queries fast.

Will I see this at Citadel or Two Sigma?+

Yes, both have reportedly asked it. At finance shops, the focus tends to be cleaner implementation and explaining your complexity trade-offs rather than squeezing every microsecond. At DoorDash and Coursera, expect stricter time and space limits, so Trie efficiency matters more.

Want the actual problem statement? View "Search Suggestions System" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.