"Coding is just like talking to a unknown girl. Once you talked to her with guts, the next time you'll never afraid",Really? Yes , try it Now !!!
Everything here is for education and learning purpose only , individual holds rights on outer posts/links etc.
Team Cracking The Code
About Me
▼
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.
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.
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)
ReplyDeleteHow can palindrome be solved with state machines? Palindromes can't be solved with DFAs.
ReplyDeleteI think we need to get the help of recursion. This will help in getting us implicit extra space of stack.