One Optimisation If Getting TLE in Py


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

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

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