adshin21's blog

By adshin21, history, 6 years ago, In English

Problem Link

My solution in Python3... Link 1

My Solution in PYPY3... Link 2

Any suggestion will be also great.

Thank You !

  • Vote: I like it
  • -9
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Each interpreter has different performances depending on the use case: https://pybenchmarks.org/u64q/python3.php

»
6 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

Python and PyPy are not the same thing. PyPy is usually quicker but that isn't always the case. BTW the reason why you are getting TLE is because you are using += on the strings. This is incredibly slow because strings cannot be modified in python (they are immutable), so it creates a new copy of the string every single time you do +=. Instead do this and you will pass without any problems.