Question d’entretien chez ServiceNow

Coding question: TwoSum - Brute force and then how would I improve it without using hash.