so maintain 2 pointers , one for start and other for finish
for aba , start=1 and finish=3for next  aba , Tempstart=5, Tempfinish =8 check 
with previous start and finish
if ( Tempstart==finish+1 or finish+2)finish=Tempfinish;elseif(finish-start < 
Tempfinish-Tempstart)start=Tempstart and finish=Tempfinish
--- On Sun, 22/8/10, Giri <[email protected]> wrote:

From: Giri <[email protected]>
Subject: [algogeeks] Re: Longest Palindromic Substring
To: "Algorithm Geeks" <[email protected]>
Date: Sunday, 22 August, 2010, 9:29 PM

urs s correct 1ly for few cases.. but in the following case it doesnt
give the longest seq:
abadabac
here 'aba' will be printed and not 'abadaba', which s d correct ans

On Aug 22, 5:18 am, venkatesan B <[email protected]>
wrote:
> use stackpush one by one element before compare to top 2 element in stack {if 
> same then pop element and compare next char of string with top char in 
> stackif same continue otherwise clear stack}else{push element to stack}
> if wrong correct me

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to