One Optimisation If Getting TLE in Py


#1

remove consecutive stars “" before forming the two d matrix.
as two or more consecutive "
” is logically same as one “*”.
This helped me fix TLE !


#2
    temp = B[0]
    for i in range(1, m):
        if B[i] == "*" and B[i] == temp[-1]:
            continue
        else:
            temp += B[i]
    B = temp

This is how removed the consecutive “*”, but I am still getting TLE in python3.