Kodesinc interview question

How would you reduce the time complexity of your code?