Lesson overview · Free interview practice

Suffix Arrays and Suffix Trees

Advanced data structures for efficient string processing.

Topics in the full lesson
  • Concept and Use Cases
  • Key Concepts
  • Time and Space Complexity
  • Suffix Array and Suffix Tree Construction and Methods
  • Practical Tips and Tricks
  • Common Gotchas
  • Advanced Topics
  • Interview Tips and Tricks
  • Common Mistakes

Try the free interview questions

Work through a question before revealing its explanation. These questions and answers are free; Premium adds the full lesson walkthrough, examples and implementation detail.

Question

Given a string s, return the length of the longest substring that appears at least twice in s (the two occurrences may overlap), or 0 if no substring repeats.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

Question

Design a StreamChecker that is initialized with an array of words. Implement query(letter), which appends letter to a running stream of characters received so far and returns true if any suffix of that stream equals one of the words in the dictionary.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

Explore the full Suffix Arrays and Suffix Trees material

Premium includes the complete lessons and implementation references. Free practice questions remain available without a subscription.

All course tracks & premium content
From basics to advanced masterclasses
Built for JS/TS developers like you
Real-world tips & common pitfalls
Upgrade to Premium