Pergunta de entrevista da empresa Cisco

how to improve time complexity of program