Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int example4(int[] arr) {
- int n = arr.length;
- prefix = 0;
- total = 0;
- for (int j=0; j < n; j++) {
- prefix += arr[j];
- total += prefix;
- }
- return total;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement