PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Enigma

Search Book Titles

Last updated: Apr 22, 2026

Quick Overview

This question evaluates proficiency in string processing, tokenization, case-insensitive matching, anagram detection, and algorithmic design for efficient search and deduplication.

  • medium
  • Enigma
  • Coding & Algorithms
  • Software Engineer

Search Book Titles

Company: Enigma

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of book titles and a user query string. Return all titles that are relevant to the query. A title is considered relevant if **any token** in the title matches the query under at least one of these rules: 1. **Exact match**: the token equals the query, ignoring case. 2. **Autocomplete match**: the token starts with the query, ignoring case. 3. **Reordered-letter match**: the token is an anagram of the query, ignoring case. For example, `culb` matches `Club` because they contain the same letters. Requirements: - Tokenize each title into words by splitting on spaces. - Matching is case-insensitive. - Return each matching title at most once. - Preserve the original input order of titles. Example: - Titles: `["The Luck of Club"]` - Query: `"Luck"` -> return `["The Luck of Club"]` - Query: `"luc"` -> return `["The Luck of Club"]` because `luc` is a prefix of `Luck` - Query: `"culb"` -> return `["The Luck of Club"]` because `culb` is an anagram of `Club` Design and implement an efficient function for this search problem. Discuss the trade-offs between preprocessing the titles and answering queries quickly.

Quick Answer: This question evaluates proficiency in string processing, tokenization, case-insensitive matching, anagram detection, and algorithmic design for efficient search and deduplication.

Enigma logo
Enigma
Feb 3, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

You are given a list of book titles and a user query string. Return all titles that are relevant to the query.

A title is considered relevant if any token in the title matches the query under at least one of these rules:

  1. Exact match : the token equals the query, ignoring case.
  2. Autocomplete match : the token starts with the query, ignoring case.
  3. Reordered-letter match : the token is an anagram of the query, ignoring case. For example, culb matches Club because they contain the same letters.

Requirements:

  • Tokenize each title into words by splitting on spaces.
  • Matching is case-insensitive.
  • Return each matching title at most once.
  • Preserve the original input order of titles.

Example:

  • Titles: ["The Luck of Club"]
  • Query: "Luck" -> return ["The Luck of Club"]
  • Query: "luc" -> return ["The Luck of Club"] because luc is a prefix of Luck
  • Query: "culb" -> return ["The Luck of Club"] because culb is an anagram of Club

Design and implement an efficient function for this search problem. Discuss the trade-offs between preprocessing the titles and answering queries quickly.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Enigma•More Software Engineer•Enigma Software Engineer•Enigma Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ 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.