PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Etsy

Implement streaming autocomplete under tight memory

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design a memory- and latency-constrained autocomplete service, testing skills in data structure selection, string/Unicode normalization, approximate string matching, concurrency, dynamic updates, and algorithmic time/space analysis.

  • Medium
  • Etsy
  • Coding & Algorithms
  • Data Scientist

Implement streaming autocomplete under tight memory

Company: Etsy

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Build an autocomplete service: Input: a list of up to 5,000,000 UTF-8 words (may include accents and hyphens), each with an integer popularity score that can change hourly; and a real-time stream of keystrokes forming a prefix p. Output: after each keystroke, return the top 5 suggestions that start with p, tie-breaking by higher popularity then lexicographic order. Constraints: 99th-percentile latency < 20 ms at 5,000 QPS; memory budget ≤ 300 MB; support ~1,000 inserts/deletes per second; case-insensitive matching with Unicode normalization (e.g., 'cafe' should match 'café'); if fewer than 5 exact-prefix matches exist, backfill with edit-distance-1 suggestions. Questions: Which data structure(s) would you choose (e.g., compressed trie, ternary search tree, DAWG, or sorted arrays + binary search) and why? How would you maintain per-prefix top-5 without exploding memory (e.g., small heaps, shared postings, or lazy enumeration)? How will you support dynamic updates and concurrent reads/writes with correctness guarantees? How do you paginate beyond 5 while preserving stable ordering? Provide time/space complexities and stress-test strategies. Discuss edge cases (very long shared prefixes, non-ASCII input, empty prefixes) and failure mitigations.

Quick Answer: This question evaluates a candidate's ability to design a memory- and latency-constrained autocomplete service, testing skills in data structure selection, string/Unicode normalization, approximate string matching, concurrency, dynamic updates, and algorithmic time/space analysis.

Etsy logo
Etsy
Oct 13, 2025, 9:49 PM
Data Scientist
Technical Screen
Coding & Algorithms
4
0

Build an autocomplete service: Input: a list of up to 5,000,000 UTF-8 words (may include accents and hyphens), each with an integer popularity score that can change hourly; and a real-time stream of keystrokes forming a prefix p. Output: after each keystroke, return the top 5 suggestions that start with p, tie-breaking by higher popularity then lexicographic order. Constraints: 99th-percentile latency < 20 ms at 5,000 QPS; memory budget ≤ 300 MB; support ~1,000 inserts/deletes per second; case-insensitive matching with Unicode normalization (e.g., 'cafe' should match 'café'); if fewer than 5 exact-prefix matches exist, backfill with edit-distance-1 suggestions. Questions: Which data structure(s) would you choose (e.g., compressed trie, ternary search tree, DAWG, or sorted arrays + binary search) and why? How would you maintain per-prefix top-5 without exploding memory (e.g., small heaps, shared postings, or lazy enumeration)? How will you support dynamic updates and concurrent reads/writes with correctness guarantees? How do you paginate beyond 5 while preserving stable ordering? Provide time/space complexities and stress-test strategies. Discuss edge cases (very long shared prefixes, non-ASCII input, empty prefixes) and failure mitigations.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Etsy•More Data Scientist•Etsy Data Scientist•Etsy Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.