Editorial python3 solution gives TLE


#1

Editorial python 3 solution gives TLE


#2

editorial runs fine, but I faced similar issue when running my solution with same logic (not sure if python solutions are getting TLE for this qn)