Pergunta de entrevista da empresa SAP

for the coding interview, they asked the two sums problem