PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/DoorDash

Implement string matching with follow-up

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of efficient string-matching techniques, handling of Unicode and very long inputs, and design of data structures for simultaneous multi-pattern search, within the Coding & Algorithms domain.

  • Medium
  • DoorDash
  • Coding & Algorithms
  • Software Engineer

Implement string matching with follow-up

Company: DoorDash

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given a text T and a pattern P, implement a function firstIndex(T, P) that returns the starting index of the first occurrence of P in T, or -1 if absent. Aim for O(|T| + |P|) time and O(|P|) extra space. Discuss how you would handle Unicode and very long inputs. Follow-up: extend your solution to support searching for k patterns P1..Pk simultaneously and return all starting indices for each pattern; outline the data structure and runtime trade-offs.

Quick Answer: This question evaluates understanding of efficient string-matching techniques, handling of Unicode and very long inputs, and design of data structures for simultaneous multi-pattern search, within the Coding & Algorithms domain.

Related Interview Questions

  • Maximize Chef Assignment Profit - DoorDash (medium)
  • Compute Courier Delivery Pay - DoorDash (easy)
  • Compute Nearest Destination Distances - DoorDash (easy)
  • Compute Driver Pay with Double-Pay Windows - DoorDash (medium)
  • Count changed nodes between two menu trees - DoorDash (hard)
DoorDash logo
DoorDash
Jul 31, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0

Given a text T and a pattern P, implement a function firstIndex(T, P) that returns the starting index of the first occurrence of P in T, or -1 if absent. Aim for O(|T| + |P|) time and O(|P|) extra space. Discuss how you would handle Unicode and very long inputs. Follow-up: extend your solution to support searching for k patterns P1..Pk simultaneously and return all starting indices for each pattern; outline the data structure and runtime trade-offs.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More DoorDash•More Software Engineer•DoorDash Software Engineer•DoorDash 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.