Suppose I have a character stream as my input.
What is the best way to find the longest palindromic substring after adding each new character without reprocessing
the whole line again?
After entering each new character, I want to escape on top of previously processed lines.
Is there a tree data structure that I can use:
1. That I do not rebuild from the very beginning with each new character.
2. Where I can move nodes and leaves as the line gets incrementally longer.
How to build two trees, one for a string (prefix tree),
another for inverting a string (suffix tree)?
source share