Algorithm · Bloomberg · Hard
You are tasked with creating a class that observes a sequential stream of characters and, at any moment, can efficiently report whether the complete string built from every character seen so far is a palindrome (reads the same backward as forward). Implement the PalindromeStream class with these operations: void track(char c) – accepts the next character c and appends it to the monitored sequence. boolean isPalindrome() – returns true exactly when the current concatenated…
Checking your access…