Dictionary Tokenizer with Longest Match
Asked at Google · Coding Questions · Difficulty: Easy · Last asked Jun 15, 2026
A tokenizer turns text into a list of integer ids using a fixed vocabulary of tokens. It reads the text from left to right and always takes the longest vocabulary token that fits at the current position. Characters that no token covers are dropped.
Loading the problem…
More Google interview questions
- LLM conceptual questions
- Implement a Nested Tic-Tac-Toe Game Engine
- ML Fundamentals Deep Dive (AI/ML & MLE Roles)
- Design a Real-Time Product Recommendation System
- Implement Scaled Dot-Product Attention
- Design a Multi-Tenant, Multi-Region API Rate Limiter