Skip to content
Preptima

Tries & Advanced Strings interview questions

Prefix trees, autocomplete, and pattern matching for search-heavy roles.

3 questions in Data Structures & Algorithms.

medium2

mediumCodingConcept

You need to find a substring in linear time and the interviewer will not accept a library call. What do you compute, and what goes wrong on a collision?

Rabin-Karp computes a polynomial hash of the pattern and a rolling hash of each text window, updated in constant time per step modulo a large prime. Equal hashes only nominate a candidate, so you compare characters before reporting it. Skip that check and a collision is a wrong answer; keep it and collisions cost time.

5 minmid, senior

hard1