Microsoft interview question

Two sum question and its time complexity.