Strings and tries interview questions

Prefix trees for lookups and suggestions, expanding around centres, linear-time pattern search, and what Python strings cost.

5 quick facts

– interview-ready · 10 questions in this topic

– of 10 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. How many words start with a given prefix?Predict
  2. Longest stretch that reads the same backwardsPredict
  3. First place a pattern appears in a textPredict
  4. Top three suggestions as you typePredict
  5. Look up words where '.' stands for any letterPredict
  6. Count the stretches that read the same backwardsPredict
  7. Longest start shared by every wordPredict
  8. What Python string operations costPredict
  9. Trie or hash set?Pick the fix
  10. Rolling hashes for pattern searchPredict

Practise this topic

Flashcards · 20

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 10 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 2 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.

Sources: Topic outline informed by the Tech Interview Handbook by Yangshun Tay and the NeetCode 150 pattern grouping by neetcode-gh, both MIT licensed. Every problem, solution and explanation is written by Best Latest Apps. Credits and license