Time complexity in Python


#1

Can any one teach me how can optimiz my code