← Whatnot Interview InsightsSoftware Engineer

Whatnot·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Whatnot SWE technical screen, one question the whole time, pretty focused on string/text processing with a trie twist. Not the hardest thing I've done but the complexity discussion at the end caught me a little off guard.

Questions Asked (1)

Q1

Given an array of messages and a list of multi-word unsafe phrases, filter out any message whose text contains one of those phrases as a contiguous word sequence. Tokenize the text first so punctuation doesn't break matching, then use a Trie built from the phrase tokens to scan each message. Walk through the implementation and discuss time and space complexity.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The trie part I had down, built it from each phrase's token list no problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then outline a solution that tokenizes messages and builds a Trie from the unsafe phrase tokens. Walk through the implementation step-by-step, and finish by analyzing time and space complexity, discussing trade-offs and potential optimizations.

Pro tip: Mention that you would preprocess the unsafe phrases into a Trie once, and reuse it for all messages, which is efficient for large message volumes. Also, discuss how tokenization choices (e.g., handling punctuation, case sensitivity, and Unicode) can affect correctness and performance.

1. Clarify requirements and edge cases

Ask about input format, tokenization rules (e.g., punctuation, case sensitivity), and whether phrases can overlap or contain special characters. Confirm expected output and performance constraints.

2. Design tokenization and Trie construction

Explain how to tokenize messages into words (e.g., using regex or splitting on non-alphanumeric characters) and build a Trie from the tokenized unsafe phrases. Emphasize that the Trie is built once and reused.

3. Implement message filtering with Trie scanning

For each message, tokenize it and scan the token sequence using the Trie to detect any unsafe phrase as a contiguous subsequence. If a match is found, filter out the message.

4. Analyze time and space complexity

Derive complexity: O(P * L) to build Trie (P phrases, avg length L), O(M * T) to scan messages (M messages, avg tokens T), and O(S) space for Trie (S total tokens in phrases). Discuss trade-offs vs. naive string matching.

5. Discuss optimizations and trade-offs

Mention possible optimizations like early termination, Aho-Corasick for multiple patterns, or handling streaming data. Discuss trade-offs between preprocessing time, memory, and query speed.

Key Points to Mention

  • Tokenization approach: splitting on non-alphanumeric characters, lowercasing, and handling Unicode.
  • Trie construction: inserting token sequences for each unsafe phrase, with a flag at terminal nodes.
  • Scanning algorithm: for each message, traverse tokens through the Trie, resetting on mismatch, and checking for terminal nodes.
  • Time complexity: O(P*L + M*T) where P=#phrases, L=avg phrase length, M=#messages, T=avg tokens per message.
  • Space complexity: O(S) for the Trie, where S is total tokens across all phrases.
  • Trade-offs: Trie vs. naive substring search, preprocessing cost vs. query speed, and memory usage.

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