Initial commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>_1480._Running_Sum_of_1d_Array</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
10
1480. Running Sum of 1d Array/Program.cs
Normal file
10
1480. Running Sum of 1d Array/Program.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace _1480._Running_Sum_of_1d_Array
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
19
1480. Running Sum of 1d Array/Solution.cs
Normal file
19
1480. Running Sum of 1d Array/Solution.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _1480._Running_Sum_of_1d_Array;
|
||||
|
||||
public class Solution
|
||||
{
|
||||
public int[] RunningSum(int[] nums)
|
||||
{
|
||||
int[] result = new int[nums.Length];
|
||||
result[0] = nums[0];
|
||||
for(int i = 1; i < nums.Length; i++)
|
||||
result[i] = nums[i] + result[i-1];
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user