Domanda di colloquio di Ancestry

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