Datadog interview question

probem solving problem 1 : accumulative sum