Skip to content · ⁨Saltar al contenido⁩

Running sum · ⁨Suma acumulativa⁩

English

Running sum

Return a new array where position i holds the sum of all elements up to and including i: [1, 2, 3, 4] → [1, 3, 6, 10]. Keep a running total and fill a fresh int[] of the same length.

Español

Suma acumulativa

Devuelve un nuevo array donde la posición i contiene la suma de todos los elementos hasta e incluyendo i: [1, 2, 3, 4] → [1, 3, 6, 10]. Mantén una suma en curso y rellena un nuevo int[] de la misma longitud.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP