ServiceNow Interview Question

Efficient way to solve 3sum problem