Given a string `sequence` of length `n`, find and return all unique substrings that are palindromes. The order of the substrings in the output should match their first occurrence in the input string `sequence`. A substring `sub` is considered a palindrome if `sub` equals its reverse (`sub` spelled backwards).
Explanation: All unique substrings that are palindromes in order of their appearance
Explanation: All unique substrings that are palindromes in order of their appearance
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak