Pregunta de entrevista de Datadog

probem solving problem 1 : accumulative sum