Question d’entretien chez Ancestry

Two sum problem - leetcode easy Interviwer asked me to do it optimized way only without using two for loops