Capital One interview question

Two sum from leet code