General Dynamics Interview Question

I was asked the programming problem 2 sum