Wednesday, May 23, 2012
You are getting a stream of characters and at any time you can be asked to find out if the string received yet is palindrome or not. There can be multiple queries.He insisted to do it in better than O(n) and No extra space.
Labels:Data
Amazon Interview
Subscribe to:
Post Comments
(
Atom
)
2 comments :
Can sb please let me know how to design the state machine for the same(to handle both even/odd palindrome and palindromes with duplicate characters)
How can palindrome be solved with state machines? Palindromes can't be solved with DFAs.
I think we need to get the help of recursion. This will help in getting us implicit extra space of stack.
Post a Comment