Python Programming Challenges for beginners?

John McMonagle jmcmonagle at NO.SPAM.velseis.com.au
Fri Nov 27 04:30:21 EST 2009


n00m wrote:
> On Nov 27, 5:24 am, astral orange <457r0... at gmail.com> wrote:
> [skip]
> 
> How about the next problem:
> you are given string "s" (len(s) <= ~10000), in the string only
> letters 'a'..'z'
> Task: to count the number of all *different* substrings of "s"
> 
> Example:
> s = 'abbaz'
> Its different substrings are:
> a
> b
> z
> ab
> bb
> ba
> az
> abb
> bba
> baz
> abbaz
> ==================
> Answer: 11

Way to fail dude.

You're missing some sub-strings.




More information about the Python-list mailing list