Pergunta de entrevista da empresa Google

Backtracking question with array sums.