Microsoft Interview Question

2 sum (brute + optimal approach)