Frage im Vorstellungsgespräch bei Bloomberg

To make a function to which add numbers and optize the solution to decrease time complexity