can anybody suggest me how to overcome time limit in python 3.
plzz share any tips . i have come with the best algorithm but still got a time limit for my code.i think my method of input is slow so plzz share a fastest method of input
2 Likes
yeah me too!
The fastest method of input is by usingā¦
āfrom sys import stdinā on the top of the code and
Wherever you are using the command āinput()ā replace it with āstdin.readline()ā.
6 Likes
we can even print the output faster using the āstdout.write(str(answer))ā
2 Likes
Is there any faster way of finding combinations of a list too ?
Iām using itertools.combinations() function and its resulting in TLE error.
Thankās bro! It is really faster
Though I import stdin, TLE problem is not solved.
1 Like