Tle error fix

can anyone tell how to fix tle error

Optimize your solution. Reduce the complexity of the code so it runs in lesser time.