Vaibhav
What do you thing the complexity of your algo is. And once you hit an
duplicate, from where will you start again?

On Fri, Jul 22, 2011 at 7:21 PM, <[email protected]> wrote:

> String is "abcded"
> l =0, h = 0
> i = 1, l = 0, h = 1, max = 1, A[a]=1
> i = 2, l = 0, h = 2, max = 2, A[b] = 2
> i = 3, l = 0, h = 3, max = 3, A[c] = 3
> i = 4, l = 0, h = 4, max = 4, A[d] = 4
> i = 5, l = 0, h = 5, max = 5, A[e] = 5
> i = 6, 'd' is encountered again, update l = A[d] = 4, new A[d] = 5, h = 6,
> max = max(5, 6-4)= max(5, 2) = 5
>
> hence ur ans = 5
>
>
> Regards
> Vaibhav Mittal
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
> On , Interstellar Overdrive <[email protected]> wrote:
> > @svm11: Take the case with original string "abcded" output should be 5
> but your algo will give the answer as 0.
> >
> >
> >
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> >
> > To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/hG6ZNcG5fMMJ.
> >
> > 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.
>

-- 
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