But checking the count is a good first step. If the count doesn't
match the result is false. If the count does match, you need to check
further. I found that my test set ran 10x faster if I checked the
count first.

Don

On May 26, 6:11 am, sunny agrawal <sunny816.i...@gmail.com> wrote:
> @senthil
> nopes, it will not work
> eg.
> S3 = "cba"
> S1 = "a"
> S2 = "bc"
> count matches but not interleaved
>
>
>
> On Thu, May 26, 2011 at 2:43 PM, Senthil S <senthil2...@gmail.com> wrote:
> > Can it be done this way ..Take count of each alphabet for all the three
> > strings and store separately.. Then for each alphabet in the third string,
> > check if its count is equal to the sum of the counts of the corresponding
> > alphabet in the first two strings .. If the counts match for all alphabets
> > then the third string is an interleaving of the first two ..
>
> > --
> > 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.
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee

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