Pergunta de entrevista da empresa Microsoft

Two sum question and its time complexity.