← Whatnot Interview Insights

Whatnot·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Technical phone screen for a software engineer role at Whatnot. One coding problem, pretty algorithmic, centered on text filtering with a Trie. They also wanted a complexity discussion at the end which I wasn't fully prepared for.

Questions Asked (1)

Q1

Given an array of messages (each a dict mapping a username to text) and a list of unsafe multi-word phrases, filter out any message whose text contains one of those phrases as a contiguous word sequence. Tokenize correctly so punctuation doesn't break matches. Implement using a Trie over phrase tokens, then discuss time and space complexity.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This was a meaty one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and edge cases, then outline a solution using a Trie built from the unsafe phrases. Explain tokenization and matching, and finally analyze time and space complexity.

Pro tip: Discuss how to handle punctuation and case sensitivity in tokenization, and mention that the Trie can be reused for multiple messages to amortize construction cost.

1. Clarify requirements and edge cases

Ask about tokenization rules (e.g., punctuation handling, case sensitivity) and whether phrases can overlap or contain punctuation. Confirm input/output format.

2. Design tokenization and Trie construction

Tokenize messages and phrases into words, stripping punctuation and normalizing case. Build a Trie where each node represents a token, and mark terminal nodes for complete phrases.

3. Implement filtering with Trie traversal

For each message, tokenize its text and traverse the Trie token by token. If a terminal node is reached, flag the message as unsafe and skip further checks.

4. Analyze complexity and discuss trade-offs

Explain that building the Trie takes O(P) time and space, where P is total tokens in phrases. Filtering takes O(T) time per message, where T is token count, plus O(M) for tokenization. Discuss alternatives like Aho-Corasick for multiple patterns.

Key Points to Mention

  • Tokenization must handle punctuation (e.g., split on non-alphanumeric characters) and case insensitivity.
  • Trie nodes store children mapping and a boolean flag indicating end of an unsafe phrase.
  • Matching is done by traversing the Trie with message tokens; if a terminal node is hit, the message is filtered out.
  • Time complexity: O(P) to build Trie, O(T) per message for matching, plus O(L) for tokenization where L is message length.
  • Space complexity: O(P) for Trie, which is efficient for shared prefixes.
  • Mention that the Trie can be reused across messages, and discuss scaling with many phrases (e.g., Aho-Corasick).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.