potter's blog

By potter, history, 3 years ago, In English

This is the question Link

Test 6

There is a diff of 2. Can anyone look why my code is wrong?

Code
  • Vote: I like it
  • -17
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

your code always transform 0 to 1

else:
     coins+=1
     t[i] += 1

where in the test case 6 it's faster to just transform 0 to -1