Google Interview Question

one question similar but simplified subset sum