Suppose I have a character stream as my input.
What is the most optimal way to find the longest palindromic
substring after each new character is added without reprocessing
the whole string all over again?
After each new character comes in, I want to avoid going
over previously processed strings.
Is there a tree data structure I can use:
1. That I do not rebuild from the start with each new character.
2. Where I can shift nodes and leaves as the string gets incrementally lengthier.
What about building 2 trees, one for the string (prefix tree),
another for the inverse of the string (suffix tree)?