PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Instacart

Implement prefix and suffix file search

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the ability to design and implement efficient string-indexing data structures and APIs for prefix-and-suffix matching, demonstrating competency with tries, suffix-related structures, inverted indexes, and time/space complexity trade-offs.

  • Medium
  • Instacart
  • Coding & Algorithms
  • Software Engineer

Implement prefix and suffix file search

Company: Instacart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

Implement data structures and APIs to store file names and support efficient queries that match both a given prefix and suffix. Provide methods add(name: string) and find(prefix: string, suffix: string) -> list of names (or IDs) that match both constraints, returning results in lexicographic order. Support up to 100,000 insertions and many queries with near-real-time updates; analyze time and space complexity and discuss alternatives (e.g., two tries, suffix automaton, inverted indexes).

Quick Answer: This question evaluates the ability to design and implement efficient string-indexing data structures and APIs for prefix-and-suffix matching, demonstrating competency with tries, suffix-related structures, inverted indexes, and time/space complexity trade-offs.

Related Interview Questions

  • Implement an In-Memory File Storage System - Instacart (medium)
  • Decode an encoded string - Instacart (medium)
  • Evaluate an arithmetic expression - Instacart (medium)
  • Implement worker time and payroll tracker - Instacart (hard)
  • Solve Two Sorted-Array Tasks - Instacart (hard)
Instacart logo
Instacart
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
4
0

Implement data structures and APIs to store file names and support efficient queries that match both a given prefix and suffix. Provide methods add(name: string) and find(prefix: string, suffix: string) -> list of names (or IDs) that match both constraints, returning results in lexicographic order. Support up to 100,000 insertions and many queries with near-real-time updates; analyze time and space complexity and discuss alternatives (e.g., two tries, suffix automaton, inverted indexes).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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

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