Okay. Worst possible test case is string of all 'a' with length equal to string
length which makes it quadratic. You can fix this quite easily. Think about
how. ;) a change in approach is recommended.
--
DK
--
You received this message because you are subscribed to the Google Groups
"Algorit
Okay. Worst possible test case is string of all 'a' with length equal to string
length which makes it quadratic.
--
DK
--
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
@kk : Your approach looks like o(n^2) and only o(n) is likely to pass TLE.
On Fri, Jun 17, 2011 at 5:38 PM, KK wrote:
> http://www.spoj.pl/problems/MINMOVE/
> This code is showing TLE after some 20th test case what else can be
> optimized???
>
> try:
>import psyco
>psyco.full()
> except
http://www.spoj.pl/problems/MINMOVE/
This code is showing TLE after some 20th test case what else can be
optimized???
try:
import psyco
psyco.full()
except ImportError:
pass
string = input()
minlen = string
length = len(string)
string += string[:]
#print(string)
index = 0
for i in