Skip to content

Instantly share code, notes, and snippets.

@kingsamadesu
Created December 3, 2020 21:13
Show Gist options
  • Save kingsamadesu/d45c2195886b623cb9043c7b1b6664a9 to your computer and use it in GitHub Desktop.
Save kingsamadesu/d45c2195886b623cb9043c7b1b6664a9 to your computer and use it in GitHub Desktop.
1480. Running Sum of 1d Array -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
Your memory usage beats 91.56 % of java submissions.
*/
class Solution {
public int[] runningSum(int[] nums) {
for(int i = 1 ; i < nums.length ; i++){
nums[i]+=nums[i-1];
}
return nums;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment