Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

running sum of 1d array leetcode solution

public int[] RunningSum(int[] nums) 
{
	int sum = 0;
	int[] result= new int[nums.Length];
	for(int i = 0; i < nums.Length; i++)
	{
		sum += nums[i];
		result[i] = sum;
	}

	return result;
}
 
PREVIOUS NEXT
Tagged: #running #sum #array #leetcode #solution
ADD COMMENT
Topic
Name
6+8 =