Microsoft interview question

had to solve two sum question