For everyone who has faced troubles passing the final testcase. Note that printing to console is pretty heavy operation (this includes debug console messages).
I think this can be a very good exercices to practice in C.
Hmm, my code is probably about the same then.
But the last test still takes over 10 sec.
I’m doing it in Bash. The only thing I store is the last known position of all elements, and the previous element.
Hello everyone, I have got a problem with my code : I don’t see how to maxsimize my code :
nb = int(input());n = int(input());ls = ;tour_final = 0
if nb < 201 and n < 1000001 :
while True and tour_final < n :
ls.append(str(nb)) #On ajoute
a = list.copy(ls);del a[-1]
if str(nb) not in a :
nb = 0
t = -2
i = True
while i :
if str(ls[t]) == str(nb) :
i = False
nb = t*-1-1
tour_final += 1
I don’t get the example:
Term 1: The first term is 0.
Term 2: Since we haven’t seen 0 before, the second term is 0.
But we have seen 0 before, namely Term 1
The “before” refers to term 1: You create the first term and in the same step you check if you have already seen the created number before.
Whenever I see the handle Crypticsy, I raise the difficulty level by one in my mind.
This is so hard!