@khattri and khurana:
traverse the string once.
suppose the string is abcdeabcdeabcde
take a hashtable (initially set the items to -1) .now hash as per
khurana's idea till no duplicate occurs.Instead of marking 1. mark the
array index in the hashtable.
so in the hash table, we have
a=0 b=1 c=2 d=3 e=4
instead of 1s and 0s...
now 'a' comes again...it is non negative in the table..
max=current index(5) - a ki hash value(0)
max=5-0=5
change the hash table value of a to new value 5. repeat..
correct me if i am wrong.. m a rookie

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

Reply via email to