Skip to content · ⁨Passer au contenu⁩

Running sum · ⁨Somme cumulative⁩

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.

Français

Somme cumulée

Retournez un nouveau tableau où la position i contient la somme de tous les éléments jusqu'à et y compris i : [1, 2, 3, 4] → [1, 3, 6, 10]. Gardez un total en cours et remplissez un int[] frais de la même longueur.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP