Pregunta de entrevista de Jupiter Money

cumulative sum sql , with and without cte