Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. public static int example4(int[] arr) {
  2. int n = arr.length;
  3. prefix = 0;
  4. total = 0;
  5. for (int j=0; j < n; j++) {
  6. prefix += arr[j];
  7. total += prefix;
  8. }
  9. return total;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement